Hi,
How do I add a checkbox to column header. I don't want to use the multiselect checkbox which is already available, I want a custom checkbox to be displayed on the grid column header(note: may be third column in the grid).
Functionality of this checkbox displayed on the header is something like selecting all the checkboxes in the grid. That is say I have 3 columns with checkboxes , so on clicking the custom checkbox I want to check all the checkboxes in 3 columns.
Please Suggest.
Thanks,
Veena
HI Vasya,
Let me clarify you question,
1. For Example, i have a data as json [{Name: Vadivel, City:Hyderabad, IsActive: true}]. only one row
2. so in my IGGrid, i want a column header as checkbox which are not bounded, but the column should contain the value of IsActive as checkbox (true means checked, false means unchecked)
3. Suppose i have 5 rows , all the rows IsActive is true means, all the checkbox should be checked as well as the column header checkbox also checked, if any one of the 5 rows contains value IsActive is false means the column header should not be checked, only the column should be checked which having IsActive value as true.
Hope you understand my explanation, please feel free to ask any info or queries.
Vadivel M
Senior Programmer Analyst
Hello Vivadel,
Thank you for posting in our community
Let me clarify whether I understood your requirement correctly. Can you please answer the following questions:
This information is going to be highly appreciated and will help me decide how to proceed further.
Looking forward to hearing from you.
I am passing the json data to the IG Grid from the view model, i want a column dynamically as Checkbox as header,and one checkbox column for all the other rows, one rows have a data bool , so the checkbox should be check if the bool value is true or else unchecked and vice versa, in case if all the rows have the data is true means all the checkbox should be check and header checkbox also should be cheked, if any one of the value is not true, the header checkbox should be unchecked.
Hope you understand my requirements, please suggest me on this .
Please fee free to ask any queries.
Thanks
Vadivel (India)
I was able to get the checkbox added to the column header. I have a requirement where I should show the checkbox tick color as RED instead on black.
I have added custom checkboxes to the igGrid even the same style should be applied to those checkboxes as well.
headerRendered:function (evt, ui) {
$(_$selectDisplayGrid.igGrid("headersTable").find("span")[0]).prepend("<input type='checkbox' id='checkAllCheckBox'/>");
}
used below function for formatter to add custom checkbox.
_buildCheckBox =function (value) {
if (value !== null && value !== "") {
return "<input type='checkbox' class='selectedDisplay' id='" + value + "'/>";
else {return "";}}
How do I do that?
Kiran
Thanks for the post. It worked fine :)