Select rows on clicking checkbox in Wjcgrid

Posted by: venkat.sub on 17 September 2017, 8:53 pm EST

  • Posted 17 September 2017, 8:53 pm EST

    I need something similar to this.

    https://global-cdn.grapecity.com/blogs/legacy/wijmo/2014/10/CheckBox_Selection_LV.html

    but in wjcgrid.

    Could anyone share sample code for this

  • Posted 18 September 2017, 7:16 pm EST

    HI Venkat,

    If we understand correctly, you would like the same for Wijmo 5 FlexGrid. Please refer to the fiddle for the same.

    http://jsfiddle.net/mkgupta911/pq58z0yj/

    Please let me know if you have any further queries.

    Thanks,

    Manish Kumar Gupta

  • Posted 18 September 2017, 10:09 pm EST

    Hi Manish,

    This is exactly what I required! One more doubt, can we have the same selector checkbox on the row header, and select all checkbox when I click on the top left?

  • Posted 19 September 2017, 7:29 pm EST

    Hi, Venkat,

    You can use this approach with rowHeaders too. You need to replace cells with rowHeaders and columnHeaders with topLeftCells in the code.

    For your reference, please refer to the updated fiddle for the same.

    http://jsfiddle.net/mkgupta911/pq58z0yj/3/

    Thanks,

    Manish Kumar Gupta

  • Posted 21 September 2017, 1:47 am EST

    Thanks Manish,

    Appreciate your help! :slight_smile:

  • Posted 21 September 2017, 6:40 pm EST

    Hi Manish,

    We just tried implementing the same in our POC, but we can see that

    1. If we click on selectAll button, only the rows which are in the current DOM view is selected, rows below the view are not selected.

    2. If I scrolldown and again scrollup, the rows selected previously are getting unselected.

    Could you please provide a solution for this?

    Thanks,

    Venkat

  • Posted 24 September 2017, 5:28 pm EST

    Hi Manish

    I also face the same issue. The sample code provided by you is not working as expected. I have added few more rows to the collection. I select few rows, scroll down and when I come back, the checked checkboxes appear unchecked.

    Also, Could you please let me know whether its possible to get row header index so that I can manipulate the selected rows based on checkbox selection.

  • Posted 25 September 2017, 5:23 pm EST

    Hi Venkat/Aswathy,

    The previously shared fiddle was not working due to getting DOM for the element which is not rendered yet.

    I have updated the fiddle, please refer to the updated fiddle for the same;

    http://jsfiddle.net/mkgupta911/pq58z0yj/5/

    Thanks,

    Manish Kumar Gupta

  • Posted 27 September 2017, 5:45 pm EST

    Hi Manish

    Now the selected rows remain unchanged. Thanks for you help

    But the row is getting selected if I click on row header (outside checkbox) without checking on checkbox. I want the row selection to happen only on checkbox check and uncheck.

    Similarly, all rows are getting selected if I click on top left cell(outside checkbox) without checking on checkbox. I want all rows selection to happen only on top left checkbox check and uncheck.

    Could you please let us know how we can achieve this?

  • Posted 28 September 2017, 6:05 pm EST

    Hi,

    The behavior observed is by design. On clicking rowHeader complete row gets selected and on topLeftCell click, complete grid.

    Hence, we need to handle mousedown and selectionChanging event to prevent default behavior.

    Please refer to the updated fiddle for the same.

    http://jsfiddle.net/mkgupta911/pq58z0yj/6/

    Thanks,

    Manish Kumar Gupta

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels