This question is locked. New answers and comments are not allowed.
Hello,
i am trying to create a checkbox matrix with the telerik grid. it seems there is a bug if i click the second checkbox. please look at the attached sample project and try to check more than one checkbox.
is there any way with the telrik grid or tree view to build a matrix like the one in the sample in the project or in the following link:
http://network.osha.europa.eu/documentation/tutorial/understanding-security/security_matrix.jpg
a main requirement is that the checkbox must respond on the first click.
Regards
i am trying to create a checkbox matrix with the telerik grid. it seems there is a bug if i click the second checkbox. please look at the attached sample project and try to check more than one checkbox.
is there any way with the telrik grid or tree view to build a matrix like the one in the sample in the project or in the following link:
http://network.osha.europa.eu/documentation/tutorial/understanding-security/security_matrix.jpg
a main requirement is that the checkbox must respond on the first click.
Regards
7 Answers, 1 is accepted
0
Hello Dominic,
I attached a modified version of your project which successfully updates the checkboxes.
Here are the changes I made:
Petur Subev
the Telerik team
I attached a modified version of your project which successfully updates the checkboxes.
Here are the changes I made:
- Updated the client template so it adds the checked attribute based on your property
e.g.
columns.Bound(m => m.CanRead).ClientTemplate("<input type='checkbox' name='checkedRecords' <#= CanRead ? checked='checked':'' #>/>") -
Since the Grid needs to enter edit mode in order to track the changes, I attached handlers for the mouseenter and mouseleave events to the table cells containing the CheckBoxes and force the cell in/out edit mode using the Grid's client-side editCell/saveCell methods (also it is needed to close all the other cells which are in edit mode before you edit the hovered cell). Check the OnRowDataBoound handler below for the implementation:
functionrowDataBound(e) {varcheckBoxCell = $("td:has(input[type='checkbox'])", e.row);vargrid = $(this).data("tGrid");$(checkBoxCell).mouseenter(function() {$(grid.element).find(".t-grid-edit-cell").each(function() {grid.saveCell(this);})grid.editCell(this);});$(checkBoxCell).mouseleave(function() {grid.saveCell(this);});}
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Houcine
Top achievements
Rank 1
answered on 11 Apr 2012, 10:04 PM
I have an mvc grid with 4 columns one of them is checkbox.
When i add a new record to the grid and check the check box, i have the following jQuery error:
jquery-1.7.1.js:1852Uncaught TypeError: Cannot read property 'nodeName' of null
This error is preventing the data in the insertedDataItems to be consistant.
I changed your sample project to add insert button. The same problem occurs with your modiefed sample.
Please advice.
When i add a new record to the grid and check the check box, i have the following jQuery error:
jquery-1.7.1.js:1852Uncaught TypeError: Cannot read property 'nodeName' of null
This error is preventing the data in the insertedDataItems to be consistant.
I changed your sample project to add insert button. The same problem occurs with your modiefed sample.
Please advice.
0
Silpa
Top achievements
Rank 1
answered on 31 Jul 2012, 04:21 PM
Hi,
I too do have a requirement to insert a record which has one column with checkbox. And I get the same error when I check the checkbox.
So, looks like the handlers for mouseenter and mouseleave events take care of only the existing records, but once we add a new record, the same problem persist.
Any suggestions on how to take care of this issue.
Thanks,
Silpa
I too do have a requirement to insert a record which has one column with checkbox. And I get the same error when I check the checkbox.
So, looks like the handlers for mouseenter and mouseleave events take care of only the existing records, but once we add a new record, the same problem persist.
Any suggestions on how to take care of this issue.
Thanks,
Silpa
0
Mike
Top achievements
Rank 1
answered on 31 Jul 2012, 06:17 PM
Any explanation for why separate code that is not documented is necessary to get this working?
0
Silpa
Top achievements
Rank 1
answered on 31 Jul 2012, 06:31 PM
Looks like Telerik grid has an issue whenever there is a checkbox within a column of the grid which has Batch editing enabled.
The checkbox doesn't get focus unlesss we click once. It throws a javascript error on first click of the checkbox.
The workaround code above handles checkbox editing in the grid to edit a cell which is already row data bound.
But it doesn't take care of newly added rows which is the second issue with the code.
The checkbox doesn't get focus unlesss we click once. It throws a javascript error on first click of the checkbox.
The workaround code above handles checkbox editing in the grid to edit a cell which is already row data bound.
But it doesn't take care of newly added rows which is the second issue with the code.
0
Mike
Top achievements
Rank 1
answered on 31 Jul 2012, 06:50 PM
I was directing my question to Telerik support. Judging from various posts I have found regarding this problem it seems like the check boxes and the grid haven't played nicely for a while. I have seen promises of it being fixed at some point (from a year or so ago). Also, the original post in this thread is from April. At least some sort of update would be nice as well as a reply to the insert problem you (Silpa) mentioned.
0
Aaron
Top achievements
Rank 1
answered on 21 Aug 2012, 03:55 PM
Our company is currently evaluating the Telerik Grid and have too encountered the issue that Houcine posted in April 2012. We too are getting an Uncaught TypeError: Cannot read property 'nodeName' of null error.
The workaround by Peter Subev does NOT fix this issue at all.
This is a pretty big showstopper and I'm surprised no one from Telerik has officially responded to this issue yet. Integration of checkboxes with a grid is a really basic functionality and should work with batch editing!
Would appreciate if Telerik provides a workaround at the very least or we will have to look into other products in the market instead of Telerik controls.
The workaround by Peter Subev does NOT fix this issue at all.
This is a pretty big showstopper and I'm surprised no one from Telerik has officially responded to this issue yet. Integration of checkboxes with a grid is a really basic functionality and should work with batch editing!
Would appreciate if Telerik provides a workaround at the very least or we will have to look into other products in the market instead of Telerik controls.