jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Grid editing and background updating
Tagged: Cell, cellendedit, DropDownList, editor, grid, jqxDropDownList, jqxgrid, row, update, updaterow
This topic contains 1 reply, has 2 voices, and was last updated by Dimitar 9 years, 11 months ago.
-
Author
-
Is there any way to determine that the grid is idle? E.g., the grid is not currently being edited, no jqxDropDownLists are open, etc?
I have a page with a grid that supports inline (as opposed to pop-up) editing. Multiple browsers may have the page open, and may be making changes. When a user submits a change, all the other browsers should update their grid. The logic behind all this works, but there’s issues updating the grid, usually resulting in error messages such as ‘Uncaught TypeError: Cannot read property ‘focus’ of undefined’. It’s always something undefined, but not always focus.
The grid has jqxDropDownLists that open automatically when double-clicked, and are automatically closed when an item in the list is selected. Methods like ‘updatebounddata’, ‘refresh’, and others will all cause jqxDropDownList events to trigger when they update the cells, causing any open jqxDropDownList the user may have open to close. Because editing is ending, the ‘updaterow’ function is being called in the grid datasource, which sends the modified record to the server.
When the client side Javascript receives an updated row, it invokes the ‘updaterow’ method via ‘$(“#jqxgrid”).jqxGrid (‘updaterow’)”. Currently, I have logic that holds off calling the ‘updaterow’ if any jqxDropDownList is open, or if the row received is has the same row number of a currently selected cell by putting the received row into a queue. The queue is processed in the ‘cellselect’ and ‘cellendedit’ event handlers.
It appears the ‘cellendedit’ is what is causing the problem. Even though editing may have ended for the cell, the grid is still performing other operations. What I appear to need is a ‘grididle’ event, or a ‘editingcomplete’ event, which only fires after *all* rendering operations have completed, including destroying any editors, etc.
I’ve tried about 6 different ways of implementing this, and have yet to find a way that is reliable. All the uncaught exception errors occur when the grid is in editing mode. I do track the ‘cellbeginedit’ and ‘cellendedit’ events, but (again) because rendering is still occuring after the ‘cellendedit’ event, there doesn’t appear to be a way to safely call the ‘updaterow’ method to update the grid in the background.
Hello jcwren,
As far as I understand, no matter how complex your scenario is, the main issue is not being able to call updaterow in the cellendedit event handler. We tested for this with the following example (also including a dropdownlist column): http://jsfiddle.net/Dimitar_jQWidgets/p9wdbLe2/ and everything works fine. Please make sure you are using the latest version of jQWidgets (3.8.0).
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.