on 03-06-2015 8:35 PM
Hi All,
I have a problem with dynamic View.
I have a Page with list when select an item go to a second page to show some fields.
The second Page fields is create dynamic, so before I do .to(secondpage) I destroy the page (if its created).
The problem is: when I destroy the page and create its again, the controller is load twice, the sapui5 pass through onInit(), onBeforeRenderer(), onAfterRender() twice, and I have some problems because I create the fields dynamic.
One problem is with Table, on second call the table gets smaller, like this pics:
First Call:
Second Call:
How I can force reload/re-render the Page without problems?
Thank You
someone???
thankyou!!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My scenario is to show reports on first View is a list of reports and second view is the report with Header and Table with data.
All content in second view is dynamic, header fields, table columns, table odata source.
But the application not only this, I have a App that start with a Tile Container
When click on container to reports, I do App.to(firstview) to show a list of reports when choose the report I do App.to(secondview), but in this case before App.to I destroy the page because I have to pass through createcontent again.
But in this case the Table with visibleRowCountMode="Auto" get smaller.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes that's correct, but you don't call a method in your xxxx.view.js, but it should be in your xxxx.controller.js instead -- you shouldn't have any functions in your view file, and XMLViews and HTMLViews don't allow for any code ayway
this.getView().rebuildTable() thus in effect calls a function 'rebuildTable()' which is defined in your controller
You may leave it to JSView if you want, but I have a personal preference for XMLViews since they tend to be cleaner and easier to read
You don't need to call the controller's onBeforeRendering I guess. In your target view, subscribe to a certain event:
var oEventBus = sap.ui.getCore().getEventBus();
oEventBus.subscribe("some.unique.channel","someEventId", rebuildTable);
Then, when you navigate, you fire that event:
oEventBus.publish("some.unique.channel","someEventId",params);
where 'params' are maybe some extra contextual information you want to send to your function, for instance:
{someParam: "Hello", someOtherParam : aSomeArray}
Now, when that event is fired, the function rebuildTable is called:
rebuildTable : function(sChannelId, sEventId, oData){
alert(oData.someParam + oData.someOtherParam[0]); // do whatever you like to rebuild your view 😉
};
See https://sapui5.netweaver.ondemand.com/sdk/#docs/api/symbols/sap.ui.core.EventBus.html for more info
Hope this explains, happy coding!
Apparently the dom is the same.
My view structure is:
-Page
-content
-ObjectHeader
-Table (VisibleRowCountMode = 'Auto')
-footer
-Bar
-Button
In this case when table get the parent component height it return of the page component, ignoring the ObjectHeader and the table get greater than Screen.
In second call show the table smaller for 1 second and then redraw bigger.
So I changed structure to:
-Page
-content
-ObjectHeader
-Panel
-Table (VisibleRowCountMode = 'Auto')
-footer
-Bar
-Button
In this case in second call the panel get smaller . I don't found why yet. I see in HTML that the panel create a <section> and a <div>, the section get the right Height but the div dont.
Thank you
is it absolutely necessary to destroy page? eventhough it is dynamic. clear content of the container
what`s your scenario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Italo,
your views should create your content and your controllers perform actions.
There shouldn't be a reason to destroy anything. the view should load as simple as navigating to it. of course, the first time visiting will be slower than the second time
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
24 | |
11 | |
9 | |
7 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.