angularjs - 如何访问可扩展行模板中的ui网格行数据?

标签 angularjs angular-ui-grid

我正在尝试使用自定义的可扩展模板实现可扩展的 ui 网格。如何访问模板中的行数据?

在 Controller 中,我定义了如下网格选项:

            scope.GridOptions =
            {
                data: customers,
                columnDefs:
                [
                    { name: "FirstName", field: "FirstName", width: 130 },
                    { name: "LastName", field: "LastName", width: 130 }
                ],
                expandableRowTemplate: 'CustomerDetails.html',
                expandableRowHeight: 150
            };

模板如下:

<div class="row">
    <div class="col-md-2">
        {{FirstName}} {{LastName}}
    </div>
</div>

谢谢!

最佳答案

我已经找到答案了。为了访问行数据,我需要在模板中使用 row.entity。

<div class="row">
    <div class="col-md-2">
        {{row.entity.FirstName}} {{row.entity.LastName}}
    </div>
</div>

关于angularjs - 如何访问可扩展行模板中的ui网格行数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30959674/

相关文章:

angularjs - 如何在有 Angular 的 ui-grid 单元格中添加图像

javascript - 从另一个 Controller 返回后,ui-grid api 未定义

angularjs - 如何增加使用 bootstrap AngularJs 创建的 ng-dropdown-multiselect 的宽度

javascript - 为什么数据无法在viewpage中显示?

angularjs - 注入(inject) Angular 1.4.7 cookie 服务时出错

javascript - 标题中大写字母之间的 Angular UI 网格空间

javascript - 如何仅在 AngularJS ui-grid 3.0 的第一组行中显示按钮?

angularjs - Angular 谷歌地图搜索框指令: events don't fire when trying to restrict the search (with autocomplete option)

javascript - AngularJS中的动态复选框过滤

javascript - 为什么我的 Angular.js fiddle 不起作用?