jQWidgets Forums

jQuery UI Widgets Forums Grid Set value of Cell Editor

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

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Set value of Cell Editor #56853

    Benji6996
    Participant

    Is there a way to set the value of a cell editor?

    I have a grid whereby 1 column is ‘editable’. When a cell on this column is ‘double clicked’, the value of the cell changes to that of the adjacent cell. Because the cell will be in ‘edit mode’ when the cell is double clicked, I need to change the value of the editor, NOT the value of the cell…

    At the moment I am using the following code (this works but could probably be done better):

    $("#grid").on('celldoubleclick', function(e){
    	// Insert the value from balance if the cell
    	// is 'this_pack'
    	if(e.args.datafield=='this_pack'){
    		// Get the balance from the row
    		var balance = $('#grid').jqxGrid('getcellvalue',e.args.rowindex,'balance');
    		$("#grid").jqxGrid('endcelledit',e.args.rowindex,'this_pack',true);
    		$("#grid").jqxGrid('setcellvalue',e.args.rowindex,'this_pack',balance);
    		$("#grid").jqxGrid('begincelledit',e.args.rowindex,'this_pack');
    	}
    });
    Set value of Cell Editor #56859

    Peter Stoev
    Keymaster

    Hi Benji6996,

    You should implement the initeditor column callback function as we do in our editing samples. One such example is: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/cascadingediting.htm?arctic

    Best Regards,
    Peter Stoev

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

    Set value of Cell Editor #56873

    Benji6996
    Participant

    Thanks Peter! 🙂

    I know how to use the ‘initeditor’ callback, but how do I use it with the ‘celldoubleclick’ event?

    Set value of Cell Editor #56874

    Peter Stoev
    Keymaster

    Hi Benji6996,

    You can’t due to the fact that the “initeditor” is called automatically by the Grid, not by the user.

    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.