【问题标题】:Create Dynamic Table using row data as column headers in OJET在 OJET 中使用行数据作为列标题创建动态表
【发布时间】:2020-07-15 21:47:02
【问题描述】:

如何使用子表中的行数据并将其显示为父表上的列数据(一行是标题,下一行是相应数据),同时显示父表中的一些附加数据。

【问题讨论】:

    标签: oracle-jet


    【解决方案1】:

    在您的模型和 html 中,您需要遵循相同的:

    即:

    ...
    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>  

    瞧,这将允许您动态处理列。

    希望对您有所帮助,问候。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-18
      • 2012-12-31
      • 1970-01-01
      • 2013-02-07
      • 2021-11-07
      • 1970-01-01
      • 1970-01-01
      • 2012-11-01
      相关资源
      最近更新 更多