jQWidgets Forums

jQuery UI Widgets Forums Grid How to keep state of custom checkbox in jqx grid

This topic contains 5 replies, has 2 voices, and was last updated by  sirisha 9 years, 9 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author

  • sirisha
    Participant

    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.


    Peter Stoev
    Keymaster

    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 Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    sirisha
    Participant

    Hi 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/


    sirisha
    Participant

    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.


    Peter Stoev
    Keymaster

    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 Stoev

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


    sirisha
    Participant

    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.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.