Limit number of rows to add to a child/detail grid

2 posts, 1 answers
  1. Michael
    Michael avatar
    6 posts
    Member since:
    Sep 2015

    Posted 22 Sep Link to this post

    Say I have a master grid with a nested grid defined via a detail template, and that detail grid has popup editing enabled.
    Now, if the master grid has a column with e.g. 'MaxDetailRows' to determine the maximum number of records that can be added in the detail grid - how can I check that the number or rows in the detail grid during editing does not exceed the value held in MaxDetailRows.

    Here is the edit event code I have as a start :

    function onEditDetailGrid(e) {
        //get editor window object
        var kendoWindow ="kendoWindow");
        if (e.model.isNew()) {
            // ==> Here I would like to read the master grid's row, and read a column/cellvalue (e.g. 'MaxDetailRows')
                          if (number of rows in the detail grid == MaxDetailRows)


                                       return false;


                title: "New Detail Record"

    Thanks in advance,


  2. Answer
    Eyup avatar
    2941 posts

    Posted 26 Sep Link to this post

    Hello Mike,

    You can achieve this requirement using the following approach:
    function detailGridEdit(e) {
        if (e.model.isNew()) {
            var masterRow = e.container.parents(".k-detail-row").prev(".k-master-row").first();
            var item = $("#grid").data('kendoGrid').dataItem(masterRow);
            var value = item.ProductName;

    I hope this will prove helpful.

    Telerik by Progress
    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 AJAX banner
Back to Top