I am using a Kendo Grid in which all data are bounding with one fixed row checkbox as the first row of he grid (which is hard-coded) I want this row to be freezed ;For that I have used "locked = true" in the columns . But here the problem if I use this my next jquery functions are not working and foremost Let us suppose there are 10 item (pagination) for that it is showing only 9 checkboxes but If i will change item per page then It works fine how to Resolve this type of Error
One Doubt is
If I putting Checkbox Row as Locked=true then is it become outside of the parent Grid i.e required to find the particular check box for that row I am using parent function to find the particular check box of that row after putting locked=true then parent function is not working
On click of row (td) that particular checkbox should checked and if it checked then it should uncheck
If I put locked = true then my function is not working else it's working fine
My function are
function Checkboxselection(){
$('td').click(function(){
var finder = $(this).parent();
console.log(finder);
var ischecked = finder.find(".childCheckbox").prop('checked');
console.log(ischecked);
if(ischecked==true){
finder.find(".childCheckbox").prop('checked',false);
}
else{
finder.find(".childCheckbox").prop('checked',true);
}
});
}
18 Answers, 1 is accepted
Hi All,
My name is M.Gautam sorry for not introducing myself first
Hello M,
Indeed, when locked columns are used, the Grid content is split into two separate tables - one for the locked columns and one for the non-locked. Thus, in order the code in question to work you will need to find the associated locked row and search for the checkbox there. For example:
var
grid = $(
"#grid"
).data(
"kendoGrid"
);
var
lockedRow = grid.lockedTable.find(
"tr"
).eq(finder.index());
lockedRow.find(
":checkbox"
).prop(
"checked"
,
true
);
Rosen
Telerik
Feel free to use an implementation for finding the associated TR element which matches your personal preferences. However the general approach and reason is this the one described in my previous message.
Regards,
Rosen
Telerik
Thank you Rosen for your Effort Actually I am new to Kendo Grid so Iam unable to find the associated locked row could you please eloberate your answer it will be appreciated for eloverating your own answer
Thanks in Advance......
Hello M,
Could you please elaborate a bit more about what is not clear about the snippet I have provided.
Here is a bit more annotated version.
var
finder = $(
this
).parent();
// the clicked row element
var
grid = $(
"#grid"
).data(
"kendoGrid"
);
// get reference to the Grid widget
var
lockedRow = grid
.lockedTable
// reference to the locked table
.find(
"tr"
).eq(finder.index());
// finds the row with the same index as the one clicked (the finder)
// finds the checkbox inside the row and set it as checked
// here we assume that the checkbox is always inside the locked portion of the grid
lockedRow.find(
":checkbox"
).prop(
"checked"
,
true
);
Regards,
Rosen
Telerik
In this what is lockedTable?
I am unable to find it
Hello,
This, as I have noted in the inline comments, is a field of the Grid widget, which holds reference to the lockedTable element. It is the same as using the following selector $("#grid").find(".k-grid-content-locked > table").
Regards,Rosen
Telerik
I have used like that only but on using this
(var lockedRow = grid.lockedTable.find("tr").eq(finder.index());)
it came error as ''lockedTable is undefined ''
Hello,
Most probably you do not have locked columns enabled or the grid variable does not reference the Grid widget instance or the code is executed before the Grid widget is content is rendered. You should provide a small test page which to demonstrate the error in question in order to further investigate your case.
Regards,Rosen
Telerik by Progress
Sure
Hi Rosen I have made one dummy POC using HTML Table but I need in Kendo Grid
Please follow the link
https://jsbin.com/pegibozewo/1/edit?html,js,output
Hello M,
I'm afraid I do not see any of our widgets on the test page you have provided. Unfortunately, our support service covers only issues directly related to our product. Please provide sample which demonstrates the issue with our Grid widget discussed in this thread.
Regards,Rosen
Telerik by Progress
Hi Rosen ,
I have made one dummy POC using Kendo Grid Table
Please follow the link
http://jsfiddle.net/QBESY/350/#
Hello M,
The sample you have provided is using too old version of Kendo UI library which does not support locked columns at all. Updating the sample to use a more recent version of the library and apply the suggestion approach does not yield any errors.
Regards,Rosen
Telerik by Progress
Hello M,
I'm not sure I understood your question. Could you please modify the test page from my previous reply in order to demonstrate the issue you are facing.
Regards,Rosen
Telerik by Progress