Get dynamicly grid name

3 posts, 1 answers
  1. Ludek Soukup
    Ludek Soukup avatar
    3 posts
    Member since:
    Apr 2009

    Posted 09 Aug Link to this post

    I have issue with getting grid name from toolbar component.
    I have nested grid with dynamicly fill name, in these grid i have toolbar with combobox. OnChange event in these combo i need to refresh grid where is combo placed. How i can get name of the grid? 

    <script id="template" type="text/x-kendo-template">
                 .Columns(columns =>
                     columns.Bound(o => o.HasChildren).Hidden();
                     columns.Bound(o => o.Text).Filterable(flr => flr.Cell(cell => cell.Operator("contains").ShowOperators(false)));
                     columns.Bound(o => o.ObjectPath).Filterable(flr => flr.Cell(cell => cell.Operator("contains").ShowOperators(false)));
                     columns.Bound(o => o.ChildrenPath).Filterable(flr => flr.Cell(cell => cell.Operator("contains").ShowOperators(false)));
                 .ToolBar(t => t
                      .Template("#= kendo.render(kendo.template($('\\#comboTemp').html()), [{ Text, ChildrenPath }]) #")
                 .Events(e => e.DataBound("removeExpander"))
                 .Resizable(resize => resize.Columns(true))
                 .Filterable(ftb => ftb.Mode(GridFilterMode.Row))
                 .DataSource(dataSource => dataSource
                     .Model(m => m.Id(o => o.ObjectPath))
                     .Read(read => read.Action("GetAttributes", "Rule", new {objectPath = "#= ChildrenPath #"}))
                 .Pageable(pageable => pageable
                     .PageSizes(new int[] {10, 20, 50, 100})
                 .Sortable(sort => sort.SortMode(GridSortMode.MultipleColumn))
    <script type="text/x-kendo-template" id="comboTemp">
                      .Events(events => events.Change("onNestedSchemaChange"))
                      .DataSource(ds =>
                          ds.Read("GetTargetSchemas", "Rule", new { objectPath = "#=ChildrenPath#" })
    <script type="text/javascript">
        function onNestedSchemaChange(e) {
            // code here

  2. Answer
    Dimiter Topalov
    Dimiter Topalov avatar
    311 posts

    Posted 11 Aug Link to this post

    Hello Ludek,

    You can get a reference to the closest Grid's element (the DIV it is initialized from) via the [data-role="grid"] attribute, and the ID of the element, returned by the mentioned query - via the jQuery attr() method:

    change: function(e) {
      var closestGridElement = e.sender.element.closest('[data-role="grid"]');
      var id = closestGridElement.attr('id');

    A reference to the actual Kendo UI Grid widget is available via'kendoGrid');

    I hope this helps.

    Dimiter Topalov
    Telerik by Progress
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
  3. Ludek Soukup
    Ludek Soukup avatar
    3 posts
    Member since:
    Apr 2009

    Posted 16 Aug Link to this post

    I was need for read nested grid.

    function onNestedSchemaChange(e) {
         var grid = this.wrapper.closest("[data-role=grid]").data("kendoGrid");;

    This is better way, but thank you.

Back to Top