oracle-jet - 在 OJET 中使用行数据作为列标题创建动态表
问题描述
如何使用子表中的行数据并将其显示为父表上的列数据(一行是标题,下一行是相应数据),同时显示父表中的一些附加数据。
解决方案
在您的模型和 html 中,您需要遵循相同的内容:
IE:
...
function Model() {
var self = this;
self.headersTableCol = ko.observableArray();
...
//In your method to retrieve data parse to JSON
//Iterate over that and for the first row apply
//transformation to the follow format in new object:
var headerJSON = {headerText: json["label"], field: json["field"]}
headerJSONArray.push(headerJSON);
...
//After loop over columns proceed with this:
self.headersTableCol(headerJSONArray);
...
<oj-table columns='[[headersTableCol]]'></oj-table>
瞧,这将允许您动态处理列。
我希望有所帮助,问候。
推荐阅读
- java - 如何获取树形图中最高值元素的 id
- semantic-web - 如何添加参考资料(证明、文章等)及其数字副本?
- java - 在二维数组(8x8)中,如何递归打印从起始位置到结束位置的序列号?
- html - 如何将两个画布元素放在一起?
- vuejs2 - Hot Reloading Aframe from Vue CLI 3
- forms - XAML 控件布局,在视图上覆盖其他控件
- python-3.x - 如何在列表中添加信息
- mysql - Mysql:如何获得具有累积和的时间片查询(意外结果)
- python - 递归问题 ...Sierpinskis 三角形
- php - CodeIgniter:表单验证回调始终返回 False