Hi Team,
I have created iggrid with checkbox
When i check few rows clicking checkbox in iggrid and then whenever i click on other cell then all my checked rows getting unchecked.
how to avoid this.
Hello Mukesh,
Thank you for posting in our community.
I believe you have Selection and Row Selectors features enabled. In this scenario, when you have some rows selected via the checkboxes and then you click on some other row the previous selection is cleared. This is the behavior by design. If you would like to select row by clicking on it and still keep the rows previously selected via checkboxes the CTRL key should be pressed while clicking on the row.
Some further information about Selection and Row Selectors features can be found in our online documentation.
Please let me know if you need any further assistance with this matter.
Hi Vasya,
Thanks for the reply.
But i cant restrict or inform any user to do like this. This can happen by mistake too.
At any point i have to maintain those checked or unchecked items
Thank you for getting back to me.
What I can suggest in order to detect whether the selection is coming from a checkbox or from clicking on a row is handling checkboxStateChanging event and afterwards rowSelectionChanging event. Basically, the idea is to use a global variable as flag. When selection is caused by the checkbox the checkboxStateChanging event is fired first. In this event the value of the flag can be set to true. Afterwards , the rowSelectionChanging event is going to be fired. In this event the flag could be evaluated (if true this means selection is coming from a checkbox, if false the selection is coming from clicking a row) and selection can be canceled. For example:
features: [ { name: "RowSelectors", enableCheckBoxes: true, checkBoxStateChanging: function (evt, ui) { //we use this variable as a flag whether the selection is coming from a checkbox isFiredFromCheckbox = true; } }, { name: "Selection", mode: "row", multipleSelection : true, rowSelectionChanging: function (evt, ui) { //check hether event is fired from checkbox if (isFiredFromCheckbox) { isFiredFromCheckbox = false; }else { //in this case selection is caused by regular selection and it is cancelled by returning false return false; } }
Attached you will find my modified sample for your reference.
7532.igGridSelectionAcrossPagesModified.zip