SAPUI5刷新片段中的模型?

时间:2019-07-12 16:42:19

标签: sapui5

有没有一种方法可以刷新片段中的模型?

我尝试了很多,但没有用,也许您得到了一些提示?

<core:FragmentDefinition xmlns="sap.ui.table" xmlns:dnd="sap.ui.core.dnd" xmlns:mvc="sap.ui.core.mvc" xmlns:core="sap.ui.core"
xmlns:m="sap.m">
<m:Dialog id="AuftragDialog" title="Aufträge">
    <m:beginButton>
        <m:Button text="Fertig" press=".onSaveAufträge"/>
    </m:beginButton>
    <m:endButton>
        <m:Button text="Abbrechen" press=".onCancelAufträge"/>
    </m:endButton>
    <m:content>
        <m:HBox renderType="Bare">
            <Table id="table1" selectionMode="MultiToggle" rows="{ path: 'Hallo>/results' }"
                visibleRowCount="10">
                <extension>
                    <m:OverflowToolbar>
                        <m:Title text="Alle Aufträge"/>
                        <m:ToolbarSpacer/>
                    </m:OverflowToolbar>
                </extension>
                <columns>
                    <Column sortProperty="Aufnr" filterProperty="Aufnr">
                        <m:Text text="Auftrags Nummer"/>
                        <template>
                            <m:Text text="{Hallo>Aufnr}" wrapping="false"/>
                        </template>
                    </Column>
                    <Column sortProperty="Ktext" filterProperty="Ktext">
                        <m:Text text="Auftrag"/>
                        <template>
                            <m:Text text="{Hallo>Ktext}" wrapping="false"/>
                        </template>
                    </Column>
                </columns>
                <dragDropConfig>
                    <dnd:DragInfo groupName="moveToTable2" sourceAggregation="rows" dragStart="onDragStart"/>
                    <dnd:DropInfo groupName="moveToTable1" drop="onDropTable1"/>
                </dragDropConfig>
            </Table>
            <m:VBox justifyContent="Center" class="sapUiTinyMarginBeginEnd">
                <m:Button class="sapUiTinyMarginBottom" icon="sap-icon://navigation-right-arrow" tooltip="Move to selected" press="moveToTable2"/>
                <m:Button icon="sap-icon://navigation-left-arrow" tooltip="Move to available" press="moveToTable1"/>
            </m:VBox>
            <Table id="table2" selectionMode="MultiToggle" rows="{
                    path: 'AuftragMeister>/results'
                }" visibleRowCount="10" noData="Please drag-and-drop products here.">
                <extension>
                    <m:OverflowToolbar>
                        <m:Title text="Selektierte Aufträge"/>
                        <m:ToolbarSpacer/>
                        <!--    <m:Button icon="sap-icon://navigation-up-arrow" tooltip="Move up" press="moveUp"/>
                <m:Button icon="sap-icon://navigation-down-arrow" tooltip="Move down" press="moveDown"/> -->
                    </m:OverflowToolbar>
                </extension>
                <columns>
                    <Column>
                        <m:Text text="Auftrags Nummer"/>
                        <template>
                            <m:Text text="{AuftragMeister>Aufnr}" wrapping="false"/>
                        </template>
                    </Column>
                    <Column>
                        <m:Text text="Auftrag"/>
                        <template>
                            <m:Text text="{AuftragMeister>Ktext}" wrapping="false"/>
                        </template>
                    </Column>
                </columns>
                <dragDropConfig>
                    <dnd:DragInfo groupName="moveToTable1" sourceAggregation="rows" dragStart="onDragStart"/>
                    <dnd:DropInfo groupName="moveToTable2" targetAggregation="rows" dropPosition="Between" drop="onDropTable2"/>
                    <dnd:DragDropInfo sourceAggregation="rows" targetAggregation="rows" dropPosition="Between" dragStart="onDragStart" drop="onDropTable2"/>
                </dragDropConfig>
            </Table>
        </m:HBox>
    </m:content>
</m:Dialog>

那是我的观点。.我只想使用路径:'AuftragMeister> / results'和ID为“ table2”

刷新第二张表
    moveToTable2: function () {
        var that = this;
        that.getSelectedRowContext("table1", function (oSelectedRowContext) {
            var oTable2 = that.byId("table2");
            //  var oFirstRowContext = oTable2.getContextByIndex(0);
            var oModel = that.getOwnerComponent().getModel();
            var mParameters = {};
            for (var i = 0; i < oSelectedRowContext.length; ++i) {
                var oNewAuftragData = {};
                oNewAuftragData.Aufnr = oSelectedRowContext[i].getProperty("Aufnr");
                oNewAuftragData.Ktext = oSelectedRowContext[i].getProperty("Ktext");
                mParameters.groupId = "createGroup";
                oModel.createEntry("/ZAUFK_VARSet", {
                    properties: oNewAuftragData,
                    groupId: "moveAufträge"
                });
            }
            oModel.setDeferredGroups(["createGroup"]);
            that.byId("AuftragDialog").setModel(oModel);
            oModel.submitChanges({
                groupId: "createGroup",
                success: function (oData) {
                    oModel.refresh(true);
            //      oTable2.getBinding("rows").refresh();
                },
                error: function (oData) {}

            });

,这是我要创建的位置,之后我想用id table2更新表中的行 但是它没有用,我竭尽全力..我听不懂..有碎片!以正常的观点,我可以做到这一点..但有一个片段?

甚至有可能吗?

0 个答案:

没有答案