Refresh after upda

3 posts, 1 answers
  1. Mateusz
    Mateusz avatar
    13 posts
    Member since:
    Jan 2015

    Posted 19 Aug 2015 Link to this post

    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. Answer
    Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 21 Aug 2015 Link to this post

    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
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Mateusz
    Mateusz avatar
    13 posts
    Member since:
    Jan 2015

    Posted 28 Aug 2015 Link to this post

    That resolved my problems thanks!
Back to Top