Grid datasource rebind on treeview onSelect

2 posts, 0 answers
  1. Dan
    Dan avatar
    9 posts
    Member since:
    May 2013

    Posted 20 May 2013 Link to this post

    Currently I have a treeview control and a grid control.
    I added a onSelect javascript, when treeview is selected, the grid control will be re-bind.
    but I don't know how to pass the parameter to Grid control.

    function onSelect(e)
    var grid = $("#Grid").data("kendoGrid");

    .Read(read => read.Action("GetGridData","Home"))

    public ActionResult GetGridData(string treeviewItem, [DataSourceRequest]DataSourceRequest request)
    Can you advise how should I pass the parameter to Grid so the grid can call to controller to return data?
  2. Dimiter Madjarov
    Dimiter Madjarov avatar
    2277 posts

    Posted 20 May 2013 Link to this post

    Hi Dan,

    You could use the Data function of the Grid's dataSource Action builder to specify a JavaScript function, that will return additional data for the controller. Here is a sample implementation for the current scenario.
    .DataSource(dataSource => dataSource
        .Read(read => read.Action("Products_Read", "Grid").Data("additionalData"))

    var treeItem;
    function additionalData() {
        return { treeViewItem: treeItem }
    function onSelect(e) {
        treeItem = this.dataItem(e.node).Name;
        var grid = $("#Grid").data("kendoGrid");;

    Please let me know if this was the information that you were looking for.


    All the best,
    Dimiter Madjarov
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top