Angularjs - Nested Grid not retaining expanded grid's filter

4 posts, 0 answers
  1. Ankita
    Ankita avatar
    2 posts
    Member since:
    Aug 2015

    Posted 20 Apr 2016 Link to this post

    How to retain expanded grid's filter after dataitem.set()? 

    even after using detailExpand and detailCollapse, for restoring expanded rows, we can not keep sort order as it was.
    here is the demo : http://dojo.telerik.com/@Ankita/AYOKA

    Steps to reproduce: 

    1) Expand Row 1 - Product ID 1 -> that will expand sub grid
    2) Sort sub grid -> keep company name desc ( you can see company name 5 on top row)
    3) Click on button Update total price. ( function call's dataItem.set() method to update parent Rows' column value)
    4) you can see Product ID 1 -> Total Price will change to $11.00, keeping sub grid expanded. but here we are lossing sort order of the sub grid. 1st row should be "Company Name 5" not "Company Name 1"

    If we do not use dataItem.set and try to assign value as 
    "parentDataItem["TotalPrice"] = 10 +  parentDataItem.TotalPrice", grid wont be updated with new value $11.00

    Constrain : we have to use "dataItem.set()" to apply css changes to editable cell. we can not use "dataItem.field = value"
    becuase it will introduce some other error.
    Can you please help me out here? 

    Thanks in advance,
    Ankita  

  2. Jiatang
    Jiatang avatar
    9 posts
    Member since:
    Sep 2015

    Posted 20 Apr 2016 Link to this post

    Not only the grid's filter, but also the order of rows and something other things.

    Order it tricky, because sometimes the user will add new rows on top the grid's. They are not in any sorting order. But we still want to retain that order, keep the new added rows on top.

     

    Basically, we don't want to refresh the nested grid when we .set the dataItem of the parent grid.

    But if refreshing is inevitable, then at least I want to restore the filter and order.

  3. Jiatang
    Jiatang avatar
    9 posts
    Member since:
    Sep 2015

    Posted 20 Apr 2016 in reply to Jiatang Link to this post

    Not only the grid's filter, but also the order of rows and some other things.
    Order is tricky, because sometimes the user will add new rows on top the grid. They are not in any sorting order. But we still want to retain it, keep the new added rows on top.

    Basically, we don't want to refresh the nested grid when we call the .set on dataItem of the parent grid.
    But if refreshing is inevitable, at least we want to restore the order as much as posible.
  4. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2062 posts

    Posted 22 Apr 2016 Link to this post

    Hello Jiatang,

    I already replied in the support thread you have opened regarding same problem. Since this might be helpful for someone else I will summarize the information provided in the support thread and post it here. 

    The dataItem.set() method will rebind/repaint the Kendo UI grid in order to apply the changes to the UI. This is the reason why all expanded rows are collapsed and needs to be expanded again. Expanding the parent row initializes the Kendo UI detail gird with its configuration options. It does not know anything about its previous state (whether there was a sorting, filtering expression applied).  Same thing applies for the newly create rows, which are not synced with the server. In order to be displayed after expanding the row they should be stored and then set manually (configuration options and new data items).

     

    Regards,
    Boyan Dimitrov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top