jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Calling endcelledit on sorted grid causes two exceptions
Tagged: grid
This topic contains 3 replies, has 2 voices, and was last updated by Peter Stoev 9 years, 11 months ago.
-
Author
-
In a previous thread (Grid editing and background updating, you referred to another thread (Fire endcelledit on editor.jqxDropDownList select?) on how to fire an endcelledit to close the drop-down list after a selection is made.
This works fine, until the list is sorted. At this point, after the item is selected from the drop-down list, two exceptions are thrown.
Uncaught TypeError: Cannot read property 'removeClass' of undefined @ jqx-all.js:7 Uncaught TypeError: Cannot read property 'focus' of undefined @ jqx-all.js:7
This jsFiddle (http://jsfiddle.net/jcwren/3fb48Lre/) demonstrates the issue. As long as the grid is unsorted, selecting an item from the state drop-down list works as expected. After sorting on the first or last name column, selecting an item from the list throws the two exceptions.
Along a similar line, calling endcelledit from inside the editor’s ‘close’ event when clicking *outside* the drop-down list causes an exception, regardless of whether or not the grid is sorted.
Uncaught TypeError: Cannot read property 'row' of null @ jqx-all.js:7
The actual goal here is to be able to end the editing on the grid when either a drop-down list item is selected, or if the user click’s outside the drop-down list. If the user clicks outside the drop-down list, but inside another grid cell, they should not still be in edit mode.
In fact, notice that the grid is set for ‘dblclick’ edit mode. Why can I single click in a cell and then start typing? Shouldn’t I have to double-click before I can edit? I can’t discern any difference in behavior between ‘dblclick’ and ‘selectedcell’, using your demo at http://jsfiddle.net/jqwidgets/5aGqc/.
Hi jcwren,
This code is a hack:
` r = row;
editor.off(‘select’);
editor.on(‘select’, function (event) {
if (event.args && r != -1) {
$(‘#jqxgrid’).jqxGrid(‘endcelledit’, r, ‘sh_st’, false);
}
});
editor.jqxDropDownList (‘open’);
`With this code, you mess up the Grid’s editing process. when the Editor is opened and when the editor is closed is something which is implemented within jqxGrid. If you want to use API for opening, closing editors, don’t do this within initeditor, createeditor, etc. Do it outside jqxGrid.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comCan you please provide an example of how one should implement this? The grid has several drop-down lists. When the cell with a drop-down list is double-clicked, it should open immediately. When the user selects the item, it should close the drop-down list.
In regards to the ‘hack’, except for the
editor.jqxDropDownList (‘open’);
, that method came straight out of your example Fire endcelledit on editor.jqxDropDownList select?.In this thread, set a different editmode for a specific cell, you explicitly state, “No, it is not possible to set a different edit mode for a specific cell. However, in the “initeditor” callback function of your column, you can call editor.jqxDropDownList(‘open’); to open the DropDownLsit automatically.“
Hi jcwren,
We don’t support workarounds and as workarounds they are prepared for very specific cases and as such are not tested for all possible options! No, there is no available sample for your specific case.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.