jQWidgets Forums

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts

  • brasio
    Participant

    Hi Peter. I don’t understand the functionality of the ESC key: it puts my row in not-editing mode without changing cell values, but unfortunately it still calls the updaterow callback function of the grid in order to send data to database. How should I call commit(false) in order to cancel the changes?

    My code is:

    
    updaterow: function (rowid, rowdata, commit) {	
                        $.ajax({
                            dataType: 'json',
    			type: 'POST',
                            url: 'myurl.php',
                            data: rowdata,
                            success: function (data, status, xhr) {
                            commit(true);
    			$('#jqxgrid').jqxGrid('updatebounddata'); //why updatebounddata if commit preserves cell changes???
                            },
                            error: function (xhr, tst, err) {
    			alert(err);
                            commit(false);
                            }
                        });
                    }
    

    brasio
    Participant

    Hi DImitar, thanks for your reply. I wrote as suggested:

    $("#jqxgrid").on('cellendedit', function (event)
    {
     if(event.args.datafield == 'mydatafield')
     {
      var column = $("#jqxgrid").jqxGrid('getcolumn', event.args.datafield);
      var row = event.args.rowindex;
      $("#jqxgrid").jqxGrid('setcellvalue', row, "mydatafield2", "myvalue");
     }
    });

    but now there is another problem: when i setcellvalue on cellendedit event, grid update method is invoked, resulting in several calls, one invoked by cellendedit event and another one for the ‘setcellvalue command’.

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