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

Refresh after upda

2 Answers 150 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Mateusz
Top achievements
Rank 1
Mateusz asked on 19 Aug 2015, 08:55 AM

Hello 

I have question how can I refresh data on TreeList after update action? 
When I am editing item i am also editing few other items. After close popup only edited item is refreshed. I need to find way how to refresh whole control. 
I tried:
- on update action return whole data
public JsonResult Update([DataSourceRequest] DataSourceRequest request, ProductCategoryViewModel category)        {          
  if (ModelState.IsValid)            {  
              var services = new ProductCategoryServices(db);               
.Update(category, ModelState);            

}            var result = db.ProductCategories.ToTreeDataSourceResult(request,                                cat => cat.ProductCategoryId                                , cat => cat.FKParentProductCategoryId                                , cat => cat.ToProductCategoryViewModel(request)                );            //DataSourceResult dataTreeList =             return Json(category, JsonRequestBehavior.AllowGet);

}

2 Answers, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 21 Aug 2015, 11:11 AM

Hello Mateusz,

In order to force the DataSource to re-fetch its data after sync operation. You could use the DataSource sync event in which handler to call the read method. Similar to the following:

@(Html.Kendo().TreeList<..>()
    .Name("treelist")
     /*..*/     
    .DataSource(dataSource => dataSource
        .Events(events => events.Sync("sync"))
        /*...*/
    )
)
<script>
function sync() {
    this.read();
}
</script>

Regards,
Rosen
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
Mateusz
Top achievements
Rank 1
answered on 28 Aug 2015, 12:34 PM
That resolved my problems thanks!
Tags
TreeList
Asked by
Mateusz
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Mateusz
Top achievements
Rank 1
Share this question
or