When setting column attribute that contains "_" in the Grid, an error is thrown.
An error is thrown due to the 'cause_error' attribute for the classification column
No errors should be thrown
Hello, Cuinn,
Thank you for the additional information.
The developer that was assigned to fix the bug appears to have come to the same conclusion. It has already been fixed for our next official release in June.
If you wish, you can modify the grid.js file with the new function definition until the release.
function decorateCellWithClass(html) {
let element = html;
let classes = element.match(/class=["][^"]+/g);
if (classes) {
const cssClasses = classes[0].split('\"').pop();
element = element.replace(cssClasses, cssClasses + " k-table-td");
} else {
element = element.replace("<td","<td class='k-table-td'");
}
return element;
}
Let me know if you have any further questions.
Regards,
Martin
Progress Telerik
To be clear:
The error occurs because the 'cause_error' attribute value contains a string that contains 'class'. NOT because the attribute name contains '_'.
I have copied the ticket text below as it actually describes the error, the cause of the error, the location of the error and a suggested fix.
This function is located in the kendo.grid.js file.
When this function is called it errors as the element.indexOf("class") check returns true. The regex then runs and fails as the regex is more specific than the simple check for the 'class' string. This causes an error in the component. Could you please use an if check that is similar to the regex so that it doesn't mistakenly trigger.