jQuery UI Widgets Forums Grid Update Value in grid

This topic contains 3 replies, has 2 voices, and was last updated by  Dimitar 10 years, 9 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Update Value in grid #50182

    tompasto
    Participant

    Hello there,
    When i send and updaterow fun ction in grid, my row object is changing and return all field values the selected row.
    See on my code below, my console.log of row got the good value in grid but the console.log in updaterow function return all data instead of the one i want.
    Here a sample of my code:

     var WLentries =
     	 {
    		    datatype: "json",
    	   	    datafields: 
    		[
    		{ name: <em>.... here all my fields
                            .....</em>    type: 'string'},
    		],
    			id: 'WL_NUMBER',
    			url: 'MyUrl/query.php?query=showWLentries&HOSPITALNO='+HospitalNo,
    			
    			updaterow: function (rowid, rowdata, commit) {
    
    				console.log(rowdata); <------------- Console Log in update function
                    var data = "query=updateWL&rowname=" + rowdata.LISTE;
                    data = data + "&id=" +rowid;
                    $.ajax({
                        dataType: 'json',
                        url: 'MyUrl/SqlDataModification.php',
                        data: data,
                        success: function (data, status, xhr) {
                           
                            commit(true);
                        }})
    			}
                        };
                   var WLData = new $.jqx.dataAdapter(WLentries);
    
    $("#ResultGrid").jqxGrid(
    	 {
    		 source: WLData,
    		 width: 1500,
    		 columns: [
    { text: 'LISTE', columntype: 'dropdownlist', datafield: 'LISTE', width: 200
      , createeditor: function (row, cellvalue, editor) {
            editor.jqxDropDownList({ source: WLcodedata, displayMember:"WLdescr",placeHolder: ""});  }
      , cellvaluechanging: function (row, column, columntype, oldvalue, newvalue) {
        if (newvalue == "") return oldvalue;
        var row = { Change: column, value: newvalue};
        var rowID = $('#ResultGrid').jqxGrid('getrowid');
        console.log(row); <------------- Console Log in Grid
        $('#ResultGrid').jqxGrid('updaterow', rowID, row);
        }
    },
    ],
    
    etc ...
    
    Update Value in grid #50203

    Dimitar
    Participant

    Hello tompasto,

    These variables (row and rowdata) are not the same, they have different scopes and values. The updaterow rowdata argument has all data of the edited row.

    We suggest you create a global variable, which is visible in both functions. Set it in cellvaluechanging and then get it in updaterow.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Update Value in grid #50240

    tompasto
    Participant

    Tx Dimitar,

    Can you tell me so, what the grid call ‘updaterow’ is use for ^
    Tx.

    Update Value in grid #50276

    Dimitar
    Participant

    Hi tompasto,

    The updaterow callback function is used to synchronize with the server (send update command). Call commit with parameter true if the synchronization with the server is successful and with parameter false if the synchronization failed.

    If it suits you, you can also use it as a general callback function after a row is updated.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

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

You must be logged in to reply to this topic.