I need to stop collapsing a detail row in kendo grid in some cases, but my code is not working:
var detailGrid = $("#grid-details").kendoGrid({
< ....>
detailCollapse: function (e) {
//operator.views.common.CheckDetailsRow(e.detailRow);
e.preventDefault();
return false;
},
<......>
}).data("kendoGrid");
5 Answers, 1 is accepted
Hello Lily,
I am would like to clarify that the event is not preventable, so I would suggest to stop the propagation of the click event (when the collapse icon is clicked) as shown in the http://dojo.telerik.com/EpohE example.
Regards,
Boyan Dimitrov
Telerik

Boyan,
Can the propagation be prevented for the individual detail item? In my scenario, the user expands the detail template and enter some % values. If the total != 100, I need to outline the grid in "red" & prevent the detailCollapse.
Can this be done?
Thanks in advance.
Hasan
Hello Hasan,
I am not sure that I understand the exact scenario. Where the user types the "%" value? I made an http://dojo.telerik.com/EpohE/4 example that shows how to prevent the collapsing for the first master row. If you expand and try to collapse the first row (with last name "Davolio") it will not allow.
Regards,
Boyan Dimitrov
Telerik

Boyan,
Thanks for responding. This example will work for my scenario.
Also, is there a way to "re-enable" the collapse of the detail grid assuming some correct value is entered?
Hasan
Hello Hasan,
The click handler is fired each time when user clicks on the collapse icon. So basically if your conditional statement reads the user input and decides whether to stop the collapsing it should work fine. The main idea is that if user input is a valid the collapsing will be not be stopped.
Regards,
Boyan Dimitrov
Telerik