Datatable master checkbox check if all the items are checked

Hi,

i have the below code
https://snippet.webix.com/opipcrcd

on the page 1(One), I have records 1-10 and i have checked them ,Now since all the records on the page 1 are checked i want master checkbox also be to checked.

  1. If i Uncheck a box in the page 1,From the 10 checkboxes and go to the page2 and come back again the state should not be lost .It means that 9 checkboxes should be checked and 1 unchecked (since i have unchecked it previously) and master checkbox should be unchecked because all the checkboxes are not checked.

How can i do that?

@Anybody

Can you please help?

@Listopad @lBeJIuk

could anyone of you please help?

Hello @prasadraju,

on the page 1(One), I have records 1-10 and i have checked them ,Now since all the records on the page 1 are checked i want master checkbox also be to checked.

Do you mean you want the master checkbox be checked across all of the pages? Or just the one that is being checked? Currently, the master checkbox is already being checked on the page with every checked item, which is why I am assuming the first option, and making the example based around this assumption. Please correct me if I’m wrong.

  1. If i Uncheck a box in the page 1,From the 10 checkboxes and go to the page2 and come back again the state should not be lost .It means that 9 checkboxes should be checked and 1 unchecked (since i have unchecked it previously) and master checkbox should be unchecked because all the checkboxes are not checked.

By default, the checkbox state will be saved across multiple pages. In your current example, this behaviour is being modified via a custom onAfterPageChange event handler. This is why you will have to either remove the handler, or modify it in any other way you see fit. In my example, I will be unchecking the items after a page change if the master checkbox was unchecked as well.

Please take a look at the end result: https://snippet.webix.com/46a429jo.