I use it, when dynamically create frame.
let frame: any = new Frame;
frame.defaultPage = "some-page";
It works, but defaultPage don't have declaration and not represented in API.
Hi @webleaf,
By design, the defaultPage property was made only to be set inline via XML. This is the reason for not exposing it in the declarations. If you think that this property should be added in the declarations, can you provide more info about your use-case and the need to create a new Frame via code behind?
Hi, @tsonevn
I need reset root view, after user logged in. Not just clear history. Because there are some situation where this is not enough: if tap Back button on android after clearing history, and then lunch app again, application.run() will not be executed, but just root view, which was specified in application.run() will be loaded (in my case it's login page), and this login page again will be opened.
The situation is further complicated by the fact that I have RadSideDrawer and other elements that should be hidden and inaccessible on the login page.
I used two root views (one for login page and other for main app business logic) and change them using _resetRootView() method after user logged in. It worked first, but there was the issue #5790.
So i find other solution:
I clear history, and use gesturesEnabled property for SideDrawer and visibility for other Views, to control their accessibility. But in app.run() i do so:
app.run({
create: () => {
console.log("Creating root view...");
const rootView = <RadSideDrawer>createViewFromEntry({moduleName: "views/layouts/main/main-layout"});
const dock = <DockLayout>rootView.mainContent;
let frame: any = new Frame;
frame.defaultPage = appSettings.getBoolean("isLoggedIn") ? "views/pages/home/home-page" : "views/pages/login/login-page";
dock.addChild(frame);
return rootView;
}
});
This do what I want.
Please, don't tell me, that i do something that not supported. I hate your framework :smiley: It' very very very inflexible. I always spend a lot of time trying to make intuitive things, but your framework answer to me "No, man, you cant do that!"
@webleaf The reason why the defaultPage property was not exposed in the API is because it simply does a navigate() call. It's just a syntactic sugar in the xml declaration. In your scenario you should be able to call frame.navigate() like so - appSettings.getBoolean("isLoggedIn") ? frame.navigate("views/pages/home/home-page") : frame.navigate("views/pages/login/login-page");. Hope this works for you.
Just encountered this while building a login page. Do this.
In your xml
<Frame defaultPage="{{ route }}"></Frame>
in your js
function onLoaded(args) {
const bindingValues = fromObject({
route: isGuest ? "views/login/login" : "views/home/home-page",
});
page.bindingContext = bindingValues;
}
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Hi, @tsonevn
I need reset root view, after user logged in. Not just clear history. Because there are some situation where this is not enough: if tap Back button on android after clearing history, and then lunch app again,
application.run()will not be executed, but just root view, which was specified inapplication.run()will be loaded (in my case it's login page), and this login page again will be opened.The situation is further complicated by the fact that I have RadSideDrawer and other elements that should be hidden and inaccessible on the login page.
I used two root views (one for login page and other for main app business logic) and change them using
_resetRootView()method after user logged in. It worked first, but there was the issue #5790.So i find other solution:
I clear history, and use
gesturesEnabledproperty for SideDrawer andvisibilityfor other Views, to control their accessibility. But inapp.run()i do so:This do what I want.