Angular ui.grid 获取嵌套行 [英] Angular ui.grid get nested rows

查看:27
本文介绍了Angular ui.grid 获取嵌套行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

过去几个小时我一直在尝试让 ui.grid 在一行内显示一个嵌套表.

I've tried for the last few hours to get ui.grid to display a nested table inside one row.

$scope.gridOptions.columnDefs = [
    {name: 'id'},
    {name: 'categoryName'},
    {name: 'products', cellTemplate: '<div ui-grid="grid.appScope.gridOptions.data"></div>'}
  ];

每一行可以没有、一个或多个产品,但我无法显示我的产品.

Each row can have none, one or multiple products, but I can't get my products to display.

我正在通过 ajax 请求 json 文件,但出于演示目的,我已将其设为静态.这是采摘者 http://plnkr.co/edit/aXgXFZQL4xgVtTNH3y2S?p=preview

I'm requesting the json file via ajax, but for demo purposes I've made it static. Here's the plucker http://plnkr.co/edit/aXgXFZQL4xgVtTNH3y2S?p=preview

提前致谢

推荐答案

是否值得为此考虑使用可扩展模块:http://ui-grid.info/docs/#/tutorial/306_expandable_grid

Is it worth considering the expandable module for this instead: http://ui-grid.info/docs/#/tutorial/306_expandable_grid

如果产品数量可变,您当前采用的方法可能会给行高带来困难,而 expandable 将允许可变数量的行.根据您的喜好,展开和折叠的能力可能是有益的,它为放置有关每种产品的更多信息提供了空间.

The approach you're currently taking will likely give difficulty with row height if the number of products is variable, whereas expandable would allow variable numbers of rows. Depending on your taste, the ability to expand and collapse may be beneficial, and it gives room to put more information about each product.

这篇关于Angular ui.grid 获取嵌套行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆