jQuery UI Widgets Forums Grid What is "commit" doing ?

This topic contains 4 replies, has 4 voices, and was last updated by  BenR 8 years, 9 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • What is "commit" doing ? #24879


    That may be a stupid question but i cannot find that function the API doc…

    addrow: function (rowid, rowdata, position, commit) {
    // synchronize with the server - send insert command
    rowdata.id = "";
    var data = "insert=true&" + $.param(rowdata);
    dataType: "json",
    url: "data.php",
    data: data,
    success: function (data, status, xhr) {
    commit(true, data.id);
    error: function (jqXHR, textStatus, errorThrown) {
    What is "commit" doing ? #24895

    Peter Stoev


    “commit” with parameter true commits the changes and updates the UI. “commit” with parameter false, cancels the changes in the UI.

    Best Regards,
    Peter Stoev

    jQWidgets Team

    What is "commit" doing ? #73891


    since commit takes commit(true, data.new_id_from_db) is the below possible ?

    updateRow: (rowid, newdata, commit) ->
         (updated_data) ->
             commit(true, updated_data)

    updated_data is the JSON Object from the database in which fields like lastupdated_on, etc.. might have changed. updatebounddata essentially does a GET again for the entire set, can that be prevented ?


    • This reply was modified 8 years, 11 months ago by  iceboxx89. Reason: better framing of the question
    What is "commit" doing ? #75703


    Hello JQ widgets Team.

    I am having a similar issue…

    Doing a test with MVC5 and editing a datagrid …

    I am able to display records, when I edit them, the table cell displays the previous value, but if I refresh the screen, it will disply the new value. So I know the value is being written to the database.

    It seems my code related to “updaterow” is having an issue with the AJAX call and ses teh AJAX call as an “error:” rather than a “success”. This is confirmed by “Alert()” code I have injected for debuggin purposes.

    Here is an excerpt of my code …

       <script type="text/javascript">
            $(document).ready(function () {
                // prepare the data
                //var data = {};
                var source =
                    dataType: "json",
                    dataFields: [
                        { name: 'id', type: 'number' },
                        { name: 'car', type: 'string' },
                        { name: 'title', type: 'string' },
                        { name: 'proj_mgr_id', type: 'string' }
                    id: 'id',
                    url: '/Project/GetProjects'
                    updaterow: function (rowid, rowdata, commit) {
                        // synchronize with the server - send update command
                        data = "update=true" +
                                    "&car="             + rowdata.car +
                                    "&title="           + rowdata.title +
                                    "&proj_mgr_id="     + rowdata.proj_mgr_id +
                                    "&id="              + rowdata.id;
                        //rowdata.id = rowid;
                            dataType: 'json',
                            //cache: false,
                            url: '/Project/UpdateProject',
                            data: rowdata,
                            type: "POST",
                            success: function (data, status, xhr) {
                                // update command is executed.
                                //commit(true, data.id);
                            error: function (jqXHR, textStatus, errorThrown) {
                                // update failed.
                                alert('Did not work');
                var dataAdapter = new $.jqx.dataAdapter(source);
                // create Tree Grid
                    width: 850,
                    source: dataAdapter,
                    theme: 'arctic',
                    editable: true,
                    //editmode: 'selectedcell',
                    pageSize: 5,
                    sortable: true,
                    filterable: true,
                    pageable: true,
                    columns: [
                        { text: 'id', dataField: 'id', width: 10 },
                        { text: 'car', dataField: 'car', width: 20 },
                        { text: 'title', dataField: 'title', width: 160 },
                        { text: 'proj_mgr_id', dataField: 'proj_mgr_id', width: 500 } 
    <div id="dataTable">
    What is "commit" doing ? #75705


    In response to my own question … Solution found! (see prior post, above)

    The line of code $("#dataTable").jqxDataTable(

    which should have been $("#dataTable").jqxGrid(

    I was really wanting to work with grid control and not the datable. I think the datatable was copied in from another sample/location, but I did not catch it for some time. The error/success response in the AJAX call was not properly handled in the datatable control, but started working after I changed controls. I also adjusted my MVC controller (and the code above to use a post directive) in order properly utlize the AJAX request in my MVC code. I used the example “CRUD with jqxGrid, ASP.NET MVC3 and SQL“.

    I hope this helps some one else in this obscure issue.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.