jQWidgets Forums

jQuery UI Widgets Forums Grid Keep old value inside cell

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

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Keep old value inside cell #75651

    Programmerswe
    Participant

    Hi!
    I’ve got a on cellendedit function. Inside the function, theres a confirm

    $("#jqxGrid").on('cellendedit', function (event) 
    		{
    			// event arguments.
    			var args = event.args;
    			// column data field.
    			var dataField = event.args.datafield;
    			// row's bound index.
    			var rowBoundIndex = event.args.rowindex;
    			// cell value
    			var value = args.value;
    			// cell old value.
    			var oldvalue = args.oldvalue;
    			// row's data.
    			var rowData = args.row;
    			
    			if (confirm('are you sure that you want to change the old value "'+oldvalue+'" to "'+value+'"?')) {
    			     Change value....
    			} else {
    			     Keep old value inside cell, cancel edit.
    	                }
               }
    

    How do i keep the old value inside the cell if the user press “cancel”?

    Keep old value inside cell #75658

    Peter Stoev
    Keymaster

    Hi Programmerswe,

    You can use setcellvalue method to update the value of a cell through the Grid’s API.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Keep old value inside cell #75686

    Programmerswe
    Participant

    Tried it, when i use

    
    if (confirm('are you sure that you want to change the old value "'+oldvalue+'" to "'+value+'"?')) {
    			     Change value....
    			} else {
                            $("#jqxgrid").jqxGrid('setcellvalue', 0, "Comment", "test");
    	                }
    

    And click “cancel” it gets stuck in a loop kinda.

    Keep old value inside cell #75692

    Peter Stoev
    Keymaster

    Hi Programmerswe,

    Solution: http://jsfiddle.net/bpnh1pkf/

    Best Regards,
    Peter Stoev

    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.