This is a migrated thread and some comments may be shown as answers.

How to prevent detailCollapse event on kendo grid (jquery)?

5 Answers 592 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lily
Top achievements
Rank 1
Lily asked on 15 Oct 2015, 06:28 PM

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

Sort by
0
Boyan Dimitrov
Telerik team
answered on 16 Oct 2015, 11:22 AM

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Hasan
Top achievements
Rank 1
answered on 12 Nov 2015, 09:45 PM

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

 

0
Boyan Dimitrov
Telerik team
answered on 16 Nov 2015, 05:11 PM

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Hasan
Top achievements
Rank 1
answered on 16 Nov 2015, 05:20 PM

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

0
Boyan Dimitrov
Telerik team
answered on 18 Nov 2015, 08:59 AM

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Lily
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Hasan
Top achievements
Rank 1
Share this question
or