导航回SAPUI5页面时,不会呈现视图的某些部分

时间:2017-09-11 09:08:57

标签: sapui5

我有3页的层次结构。当我从第3页导航回第2页(产品)时,它不会完全呈现。只有第一次导航才能正常工作。如果我从第3页返回到第一页,则从类别导航到产品也不会呈现第2页。  https://docs.meteor.com/api/collections.html

产品的XML页面如下`

<mvc:View xmlns:common="sap.suite.ui.commons" xmlns:m="sap.m" xmlns:mvc="sap.ui.core.mvc"
    controllerName="dlesDLESdashboard.controller.Solution.SolutionDetail" xmlns:dles="dlesDLESdashboard.control" xmlns:core="sap.ui.core"
    xmlns:l="sap.ui.layout">
    <Page xmlns="sap.m" title="Detail" id="SolutionDetail" class="solutionDetail" backgroundDesign="Standard" showNavButton="true"
        navButtonPress="onNavBack">
        <customHeader>
            <Bar id="__bar2_copy2">
                <contentLeft>
                    <Button id="lijsld" tooltip="back" icon="sap-icon://nav-back" press=".onNavBack" activeIcon="sap-icon://nav-back"/>
                    <Label class="HeaderFont" text="Detail" labelFor="input-b" design="Bold"/>
                </contentLeft>
                <contentMiddle>
                    <Title text="Course ID : {dlesScore>ID}" width="100%"/>
                </contentMiddle>
                <contentRight></contentRight>
            </Bar>
        </customHeader>
        <Bar id="bar2">
            <contentLeft>
                <Label text=" {dlesScore>LJ_SOLUTION}" labelFor="input-b"/>
            </contentLeft>
            <contentMiddle>
                <Label text="Course Owners : Stephen Howard" labelFor="input-b"/>
            </contentMiddle>
        </Bar>
        <Bar>
            <contentMiddle>
                <Label text="17 June 2017" labelFor="input-b"/>
            </contentMiddle>
            <contentRight>
                <Link class="toolbarUserText" text="Print" press=".linkToContributions"/>
            </contentRight>
            <contentRight>
                <Link class="toolbarUserText" text="About" press=".handleCourseClick"/>
            </contentRight>
            <contentRight>
                <Link class="toolbarUserText" text="Contacts" press=".linkToContributions"/>
            </contentRight>
        </Bar>
        <l:Grid class="sapUiSmallMarginTop" defaultSpan="L4 M6 S12" id="courseDetailsGridLayout">
            <l:content>
                <Panel class="courseContent">
                    <dles:DLESYourScoreTile topic="" dles="{dlesScore>DLES}" id="solutionDetailDLES"></dles:DLESYourScoreTile>
                    <layoutData>
                        <l:GridData id="gld222" span="L6 M6 S12"/>
                    </layoutData>
                </Panel>
                <Panel class="courseContent" height="100%">
                    <dles:NPSScoreTile topic="" nps="55"></dles:NPSScoreTile>
                    <layoutData>
                        <l:GridData id="gld221" span="L6 M6 S12"/>
                    </layoutData>
                </Panel>
                <Panel class="courseContent" height="1000px">
                    <content>
                        <TabContainer id="tabcourseDetail" class="monitoringLandscapeSelector peddingLeftRight">
                            <items>
                                <TabContainerItem id="solutionCourses" name="Courses">
                                    <content>
                                        <TileContainer id="idCoursesContainer">
                                            <tiles>
                                                <dles:ScoreTile name="{Score>name} Responses" topicId="{Score>ID}" topic="{Score>SOLUTION}" result="{Score>RESULT}"
                                                    id="tileDLESCourse" press=".handleCourseClick"></dles:DLESScoreTile>
                                            </tiles>
                                        </TileContainer>
                                    </content>
                                </TabContainerItem>
                                <TabContainerItem id="idJournies" name="Journies">
                                    <content></content>
                                </TabContainerItem>
                            </items>
                        </TabContainer>
                    </content>
                    <layoutData>
                        <l:GridData id="gld2212" span="L12 M12 S12"/>
                    </layoutData>
                </Panel>
            </l:content>
        </l:Grid>
    </Page>
</mvc:View>`

当我点击导航时,以下事件被触发,第二页navegation使用相同的方法导航到其他页面

handleCourseClick: function(oEvent) {
            var that = this;
            //get the current tile detial eg course id that can be sent to next page.
            var s = oEvent.getSource();
            var topic = s.getProperty("topicId");
            this.getRouter().navTo("solution", {
                solutionId: topic
            });
        },

导航回来,

onNavBack: function(oEvent) {
        var oHistory, sPreviousHash, oRouter;
        // in some cases we could display a certain target when the back button is pressed
        if (this._oData && this._oData.fromTarget) {
            this.getRouter().getTargets().display(this._oData.fromTarget);
            delete this._oData.fromTarget;
            return;
        }
        // call the parent's onNavBack
        BaseController.prototype.onNavBack.apply(this, arguments);
    },

和我的menifest.js代码为

"routes": [
                {
                    "pattern": "",
                    "name": "appHome",
                    "target": "home"
                },
                {
                    "pattern": "solution/{solutionId}",
                    "name": "solution",
                    "target": "solution"
                },
                {
                    "pattern": "course/{courseId}",
                    "name": "course",
                    "target": "course"
                }
            ],
            "targets": {
                "home": {
                    "viewName": "Home",
                    "viewLevel": 1
                },
                "notFound": {
                    "viewName": "NotFound",
                    "transition": "show"
                },
                "solution": {
                    "viewPath": "dlesDLESdashboard.view.Solution",
                    "viewName": "SolutionDetail",
                    "viewLevel": 2
                },
                "course": {
                    "viewPath": "dlesDLESdashboard.view.Course",
                    "viewName": "CourseDetail",
                    "viewLevel": 3
                }
            }
`

我的baseController navBack方法是

        onNavBack: function (oEvent) {
        var oHistory, sPreviousHash;
        oHistory = History.getInstance();
        sPreviousHash = oHistory.getPreviousHash();
        if (sPreviousHash !== undefined) {
            window.history.go(-1);
        } else {
            this.getRouter().navTo("appHome", {}, true /*no history*/);
        }
    }

1 个答案:

答案 0 :(得分:0)

不要将标签控件包装到gridview中。将标签控件放在gridview外面。并删除页面的xml视图中的面板文件。最好的方法是逐个删除控件并检查。