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

6 posts, 0 answers
  1. Lily
    Lily avatar
    6 posts
    Member since:
    Aug 2015

    Posted 15 Oct 2015 Link to this post

    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");

  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2035 posts

    Posted 16 Oct 2015 Link to this post

    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
  3. Hasan
    Hasan avatar
    2 posts
    Member since:
    Jan 2015

    Posted 12 Nov 2015 in reply to Boyan Dimitrov Link to this post

    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

     

  4. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2035 posts

    Posted 16 Nov 2015 Link to this post

    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
  5. Hasan
    Hasan avatar
    2 posts
    Member since:
    Jan 2015

    Posted 16 Nov 2015 in reply to Boyan Dimitrov Link to this post

    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

  6. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2035 posts

    Posted 18 Nov 2015 Link to this post

    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
Back to Top