Sapui5 动态表绑定

Sapui5 动态表绑定,sapui5,Sapui5,请建议。表绑定不起作用。 模型数据和可能的更改: ​{ "TestCloudEnvRO": [ { "pipelineName": "RP1", "cycles": [ "cy1", "cycle1", "RP1cy2", "cyc2", "crCycle" ] }, { "pipelineName"

请建议。表绑定不起作用。 模型数据和可能的更改:

​{ "TestCloudEnvRO": [ { "pipelineName": "RP1", "cycles": [ "cy1", "cycle1", "RP1cy2", "cyc2", "crCycle" ] }, { "pipelineName": "RP2", "cycles": [ "BP1-c2", "bp2-cy" ] }, { "pipelineName": "RPlocal", "cycles": [ "cyclelocal" ] }, { "pipelineName": "rp1234", "cycles": [ "cyclert" ] }, { "pipelineName": "RPTEST", "cycles": [ "BPTEST1" ] }, { "pipelineName": "rp123", "cycles": [ "cytr" ] } ] }
看法

this.byId(“idtrlAllPipelines”).bindAggregation(“items”,{path:“getHist>/TestCloudEnvRO”,template:oTemplate,templateShareable:true})

它不会加载表中的任何项。 但这在我们看来是可行的。我必须用/TestCloudEnvRO替换它,并使用图标选项卡过滤器的选定键,因此上述操作应该可以正常工作。请建议

<Table items="{path: 'getHist>/TestCloudEnvRO'}" id="idtrlAllPipelines" alternateRowColors="true">

对于您建议的绑定,您的数据集可能需要稍作修改才能达到要求。PFB代码

控制器

var oTemplate = new sap.m.ColumnListItem({ cells: [ new sap.m.Text({ text: "{getHist>pipelineName}" }) ] }); this.byId("idtrlAllPipelines").setModel(oModelEnv, "getHist");
    loadDataSet: function () {
        var oMasterModel = this.getView().getModel("oMasterModel");
        var oDataSet = [{
            "IconTabName": "Env1",
            "Table": [{
                "name": "Person1",
                "runs": ["10", "20"]
            }, {
                "name": "Person2",
                "runs": ["0", "2"]
            }]
        }, {
            "IconTabName": "Env2",
            "Table": [{
                "name": "Person3",
                "runs": ["5", "25"]
            }, {
                "name": "Person4",
                "runs": ["20", "12"]
            }]
        }];
        oMasterModel.setData({
            allFilters: oDataSet
        });
        oMasterModel.refresh(true);
    }
看法



对于每个iconTab,您应该有一个绑定不同的表。因此,每个iconTab都应该有一个像“Env1”、“Env2”这样的数据上下文。etcI不能像上面那样准备模型数据,因为它不是固定的,并且可能会更改。我已经编辑了最新的代码。请建议您编辑了实际问题。你能确切地告诉我你在这里想要达到什么目的吗?Icontab筛选器,然后在其中进行表绑定,或者只是sap.m.table的动态表绑定
    loadDataSet: function () {
        var oMasterModel = this.getView().getModel("oMasterModel");
        var oDataSet = [{
            "IconTabName": "Env1",
            "Table": [{
                "name": "Person1",
                "runs": ["10", "20"]
            }, {
                "name": "Person2",
                "runs": ["0", "2"]
            }]
        }, {
            "IconTabName": "Env2",
            "Table": [{
                "name": "Person3",
                "runs": ["5", "25"]
            }, {
                "name": "Person4",
                "runs": ["20", "12"]
            }]
        }];
        oMasterModel.setData({
            allFilters: oDataSet
        });
        oMasterModel.refresh(true);
    }
<IconTabBar items="{oMasterModel>/allFilters}">
                    <items>
                        <IconTabFilter text="{oMasterModel>IconTabName}">
                            <Table items="{oMasterModel>Table}">
                                <columns>
                                    <Column>
                                        <Label text="Name"/>
                                    </Column>
                                    <Column >
                                        <Label text="Runs"/>
                                    </Column>
                                </columns>
                                <items>
                                    <ColumnListItem>
                                        <cells>
                                            <Text text="{oMasterModel>name}"/>
                                            <Select items="{oMasterModel>runs}">
                                                <core:Item text="{oMasterModel>}"/>
                                            </Select>
                                        </cells>
                                    </ColumnListItem>
                                </items>
                            </Table>
                        </IconTabFilter>
                    </items>
                </IconTabBar>