【问题标题】:Telerik MVC Grid: Getting the Parent Row after a ComboBox OnChange event during inline editingTelerik MVC Grid:在内联编辑期间 ComboBox OnChange 事件后获取父行
【发布时间】:2011-10-07 02:01:10
【问题描述】:

我有一个父子 Telerik MVC 网格。在子网格中,我有一个 ComboBox。在该组合框的 OnChange 事件中,我需要查找某些内容的值并在此已编辑行中填充另一列。如果此子网格中已有子行,则以下代码将用于获取父行的 dataItem 对象。但是,如果没有子行(我只是添加第一行),这不起作用。

function ComboBox_OnChangeg(e) 
{
    var comboID = $("#combo").data('tComboBox').value();
    var parentID = row.closest('.t-grid').data('tGrid').data[0].ParentID;  // <--- IS NOT AN OBJECT!!!

    // ajax call, blah blah
}

在子网格中没有子行的情况下,如何获取父dataItem对象并获取父行的某一列的值?

记住:这是在线编辑期间网格中 ComboBox 的 OnChange 事件。这不是网格的 OnEdit 事件。

史蒂夫

【问题讨论】:

    标签: asp.net-mvc telerik-grid telerik-mvc telerik-combobox


    【解决方案1】:

    检查页面源时,我发现详细信息网格呈现在位于主行tr 之后的tr 上的整个表格跨度单元格中。所以:

    1. t-detail-row 类最接近的tr 祖先
    2. 找到最近的上一个兄弟tr,类t-master-row
    3. 将步骤 2 中找到的 tr 传递给主网格的 dataItem 客户端方法

      var $masterRow = $comboElement.closest('tr.t-detail-row').prev('tr.t-master-row');

      var masterData = $('#LieuLeconGrid').data('tGrid').dataItem($masterRow);

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多