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

Update TreeView After Adding Row To Grid

1 Answer 59 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Barry Burton
Top achievements
Rank 1
Barry Burton asked on 16 Mar 2014, 02:44 AM
Ok, I've hunted around for a solution to this for hours now, but to no avail...

I have a page that uses the Kendo splitter.  In the left pane is a kendo tree view and in the right, a kendo grid.  I am using the toolbar "Save" option, which adds a nice Save/Cancel button to the already existing 'Add new record' button.

I have no trouble updating the grid whenever a new node is selected on the tree view.  What I do need to know is how to do is update the tree view whenever an
existing row is updated or a new row is added to the grid. If it makes any difference, I am using .cshtml pages and not aspx.

ANY help will be GREATLY appreciated!!!

1 Answer, 1 is accepted

Sort by
0
Barry Burton
Top achievements
Rank 1
answered on 16 Mar 2014, 02:50 PM
Nevermind!! I've really got to stop thinking like an WebForms developer, but that is so hard to do, when you've been at it for ten years!

Anyway, the solution was to use the Grid DataSource RequestEnd event to trigger an update to the tree view.

.DataSource(dataSource => dataSource
     .Events(events => events.RequestEnd("onGridRequestEnd"))
)


function onGridRequestEnd(e)
{
      if(e.type == "read")
      {
          return;  // don't care about read events, only create/update/destroy
      }

      var treeview = $("#treeview").data("kendoTreeView");

      treeview.dataSource.read();
}
Tags
Grid
Asked by
Barry Burton
Top achievements
Rank 1
Answers by
Barry Burton
Top achievements
Rank 1
Share this question
or