jQWidgets Forums
jQuery UI Widgets › Forums › Grid › How to keep state of custom checkbox in jqx grid
Tagged: grid render, jquery grid cells renderer
This topic contains 5 replies, has 2 voices, and was last updated by sirisha 9 years, 9 months ago.
-
Author
-
Hi,
I have a column that has to render the cell with two images. First image is common for all rows, and for second image I have
to show an Icon for some type of records and for other records it should be a checkbox.
Whenever user clicks on checkbox I’ve to store its state in database.But when I make this custom checkbox as checked and scrolling the grid I’m loosing the state of checkboxes. How can I keep state of checkbox.
I did in this way,
http://jsfiddle.net/thp7erqa/9/
but when I scroll the grid it’s looses its state.Hi sirisha,
You have to keep the state in your own custom logic and apply it when you render the checkbox within your custom rendering function.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
For basic checking I took one variable in which I’m storing the state of checkbox on clicking, now when I scroll the grid I’m trying to bind the state of checkbox based on row Id of the grid.
But it’s not working as I expected. Could you please suggest some more for this.Please see this url
http://jsfiddle.net/thp7erqa/10/Peter,
It seems like the cellsrenderer event is not firing every time we scroll the grid. It only fires when the row / cell has never been rendered before. But then upon scrolling the cell does seems to get re-rendered, I’m not sure where the html is being retrieved from.
Hi sirisha,
The cellsrenderer is raised when it’s necessary the Grid to re-render a given cell. You should keep the state of your custom checkboxes in your code(I suppose a custom array defined outside the function) and use it within cellsrenderer when necessary.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter,
I did as you suggested by keeping an array and storing state of checkboxes inside that. But when I scroll the grid upwards/downwards it’s repainting the cells without firing cellsrenderer always. Because of this I’m unable to keep the state of checkbox.Please see the below url.
http://jsfiddle.net/thp7erqa/11/I’m raising one alert in cellrenderer event, it’s not firing always when we scroll the gird but it’s repainting cells.
-
AuthorPosts
You must be logged in to reply to this topic.