jQWidgets Forums

jQuery UI Widgets Forums Grid Easy way to send back edited data to MVC controller from grid

This topic contains 2 replies, has 2 voices, and was last updated by  Admir Hodžić 9 years, 5 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author

  • Admir Hodžić
    Participant

    First, at all
    Thanks on great thing you doing here.

    What will be proper (easy) way to send data back from jqxGrid back to conntoler.
    Is there any way to bind data from dataAdapter or jqxGrid to smoe sort of Model and send it back to Mvc conttoler for futer editing.

    In past procject we uesd ext.net framework for user front end there was nice way to read all “drtiy” data in grid.
    #{GRIDPANEL}.getRowsValues({dirtyRowsOnly: true});

    I am trying to send back all edited data in once Ajax call or postback to conntoler.

    I did saw that there is edited event on cell on demos.
    I want to send data back once when user pass thougt all grid and click save ?

    I also find http://www.jqwidgets.com/community/topic/get-all-data-in-grid/
    but that post was in 2012 is there any new rabbit in hat ?


    Peter Stoev
    Keymaster

    Hi adopilot,

    getrows method of our Grid can be used for getting its rows. Then you can use jQuery AJAX to send data.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    Admir Hodžić
    Participant

    Thanx Peter.
    For future readers here is my solution.
    best thing is that MVC whitout problems parse data back to model eve it was at grid and eddited.

    
        $("#sendData").click(function(){
            var rows = $('#jqxgrid').jqxGrid('getrows');
            var drtyRows = new Array();
            for (var i = 0; i < rows.length; i++) {
                
                if (rows[i].nar1 != 0)
                {
                    drtyRows.push(rows[i]);
                }
                //console.log(rows[i].art_id + " " + rows[i].preporuka + " " + rows[i].vsklId1 + " " + rows[i].nar1);
            }
            var jsoo = JSON.stringify(drtyRows);
            $.ajax({
                type: "post",
                dataType: "json",
                url: "/Home/primiGa",
                contentType: "application/json; charset=utf-8",
                data: jsoo
                });
        });
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.