Angular ui.grid 获取嵌套行

编程入门 行业动态 更新时间:2024-10-28 07:26:22
本文介绍了Angular ui.grid 获取嵌套行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

过去几个小时我一直在尝试让 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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-21 05:38:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/997801.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:嵌套   Angular   ui   grid

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!