How to do webix jet navigation? - webix

I am getting an error in webix jet when I navigate the URL.
The first URL is this => http://localhost:8080/#!/navigationBar/topSideBar/appslist
There is a button to call the next view, After I click the button next view URL(second URL) will => http://localhost:8080/#!/navigationBar/qtoApplication
Then, when I go back(by browser back button) to the first URL view, I got the below error, Url is changed but the view is not changing. I cannot go back to the first URL view.
I tried to add a button at the second URL view in order to go back to the first URL. It is also got the same error as per below.
I used navigationBar view as a top view, the rest is a subview.
I would like to know How to do correct navigation.
Thanks in Advance
myapp.js:9836 TypeError: Cannot read property 'linkInput' of undefined
at result._init_onchange (webix.js:30753)
at result.callEvent (webix.js:729)
at result.render (webix.js:2736)
at result.render (webix.js:28077)
at result.$setSize (webix.js:30618)
at result._set_child_size (webix.js:20648)
at result._set_child_size (webix.js:20752)
at result.$setSize (webix.js:20743)
at result._set_child_size (webix.js:20635)
at result._set_child_size (webix.js:20752)
myapp is like this,
// myapp.js
import { JetApp, EmptyRouter, HashRouter } from "webix-jet";
export default class MyApp extends JetApp {
constructor(config) {
const defaults = {
router: BUILD_AS_MODULE ? EmptyRouter : HashRouter,
debug: !PRODUCTION,
start: "/navigationBar/topSideBar/projects"
};
super({ ...defaults, ...config });
}
}
if (!BUILD_AS_MODULE) {
webix.ready(() => {
if (webix.CustomScroll){
webix.CustomScroll.init();
}
new MyApp().render();
});
}

Related

Browser back button is showing previous page after logout in Grails

I am using grails-2.4.5 version and spring-security-core-2.0-RC5. I have set a default target URI in config.groovy page. When user login then they can access to that page, when logout no access, should display only login page.
My problem is, when user logout login page is displayed, but if browser back button is hit then the default target page is displayed although he can't access any action. But it odd. My config is given below:
in config.groovy >>
grails.plugin.springsecurity.successHandler.defaultTargetUrl = '/dashboard/index'
grails.plugin.springsecurity.logout.postOnly = false
my url mapping class >>
class UrlMappings {
static mappings = {
"/$controller/$action?/$id?(.$format)?"{
constraints {
// apply constraints here
}
}
"/"(controller:"login", action: "auth")
"500"(view:'/error')
}
}
my default target uri method >>
class DashboardController {
def index() {
}
}
There are many possible ways to stop,
Browser back button is showing previous page after logout
With JavaScript, you can clear location history or disable back button.
<script>
history.pushState(null, null, location.href);
window.onpopstate = function () {
history.go(1);
};
</script>
Demo
Here you will get many possible options
Hope this will helps you.

How do I set the title for the back button on a Nav Bar in Xamarin.Forms?

I have to remove the title on the back button in several pages. I tried with this code and it works fine.
private void OnBtn ()
{
var nav = (Page)ViewFactory.CreatePage<DebugViewModel, DebugPage> ();
NavigationPage.SetHasNavigationBar (nav, true);
NavigationPage.SetHasBackButton (nav, true);
NavigationPage.SetBackButtonTitle (nav, "");
((MasterDetailPage)App.Current.MainPage).Detail.Navigation.PushAsync (nav);
}
But in some other place of the code I have this and it doesn't set the title to an empty string.
this.SettingsPageCommand = new Command (() => {
this.IsBusy = true;
NavigationPage.SetHasNavigationBar (settingsPage, true);
NavigationPage.SetHasBackButton (settingsPage, true);
NavigationPage.SetBackButtonTitle(settingsPage, "");
((MasterDetailPage)App.Current.MainPage).Detail.Navigation.PushAsync (settingsPage);
//((MasterDetailPage)App.Current.MainPage).IsPresented = false;
this.IsBusy = false;
}, () => !this.IsBusy);
I'm trying to avoid making a renderer as I want to keep as much shared code as possible.
Any ideas?
Thanks!
#hrishi's answer is correct, however if you wish to have different text shown in the Title Bar (this.Title) than shown for the Back button text on subsequent pages you can alternatively call the following method. You would call this in the constructor for the page whose title should be different on the back button:
NavigationPage.SetBackButtonTitle(this, "CustomText");
Typically I only set Title unless it needs to be different when shown for back button (ex: shorter text) in which case I set both Title and call the above method with the alternative back button text.
Title property of content page is used on next page as title of back button.
Try Setting this.Title="" on previous page of settings page

Calling of function of one page from another page in blackberry cascades using qml

In my application I have a main.qml which has a navigation pane that goes to homepage.qml and from there to profilepage.qml. When I come back from profilepage to homepage I need to trigger a function in home page. I noticed that whenever I pop back I get a call onPopTransitionEnded in the main page. Since homepage is pushed from main.qml there is no navigation pane on homepage and I cant access onPopTransitionEnded on homepage. Below are the sample structures of my 3 qml views.
main.qml
NavigationPane {
id: nav
peekEnabled: false
onPopTransitionEnded: {
console.log("POP PAGE from main");
if(page.objectName=="newProfilePage")
{
//I tried to access the function using the homepage id but didnt work
menuScreenPage.reloadView(); // This doesnt work, shows error unknown symbol menuScreenPage
}
page.destroy();
}
Page {
id: mainPage
Container {
//some code
}
onCreationCompleted: {
//Some code and then push to homepage
nav.push(homePageDefenition.createObject());
}
}
}
homepage.qml
Page {
id: menuScreenPage
objectName: "menuScreenPage"
function reloadView() //This is the function that is needed to be called on page pop from profile page
{
//some code
}
Container {
//some code
Button { //a button to push to profile page
id:pushButton
horizontalAlignment: HorizontalAlignment.Right
verticalAlignment: VerticalAlignment.Bottom
onClicked: {
console.log("I was clicked!")
nav.push(profilePageDefinition.createObject());
}
}
}
}
profilepage.qml
Page {
id: newProfilePage
objectName: "newProfilePage"
Container {
//some code
Button { //a button to pop to home page
id:popButton
horizontalAlignment: HorizontalAlignment.Right
verticalAlignment: VerticalAlignment.Bottom
onClicked: {
console.log("I was clicked!")
nav.pop();
}
}
}
}
So is there a way that I can access the function of homepage.qml from main.qml? Or is there any other function like onPopTransitionEnded which I can access on homepage.qml itself when I pop from profilepage? Please advice.
Seems that you created unnamed object with this line:
homePageDefenition.createObject()
If you want to access it later, you should save it in some property, for ex.
property var myHomePage: null
...
myHomePage = homePageDefenition.createObject()
nav.push(myHomePage )
...
myHomePage.reloadView();
Keep in mind that "menuScreenPage" is local name (id), it works only inside homepage.qml and nobody can access it beyond that file.
UPD
You can even use such code:
page.reloadView(); // Use local variable "page" instead of internal id "menuScreenPage"

Joomla setredirect override in save method breaks apply method

I have three toolbar buttons in my edit page of my component (joomla 3.0).
view.html.php
protected function addToolBar()
{
JToolBarHelper::apply('editpage.apply');
JToolBarHelper::save('editpage.save');
JToolBarHelper::cancel('editpage.cancel');
}
This works great. But now when I change the redirect path of my save method in the controller like this...
controller/editpage.php
function save()
{
parent::save();
$this->setredirect(JRoute::_('index.php?option=com_mycom&view=productlist', false));
}
... than by a click on "apply", the user was also redirected to this path. And this is the problem. Without this override method in controller, the apply button works fine. All fields will be saved and the edit page will not leave. So how can I solve that problem?
Both Save and apply method call to the same function of joomla library to save the records. The better way to over come the issue is
view.html.php
protected function addToolBar()
{
JToolBarHelper::apply('editpage.tasktoApply'); // any name other then apply
JToolBarHelper::save('editpage.tasktoSave'); // any name other then save
JToolBarHelper::cancel('editpage.cancel');
}
controller/editpage.php
function tasktoApply()
{
parent::save();
$this->setredirect('ANY CUSTOM REDIRECT AS PER YOUR NEED', false));
}
function tasktoSave()
{
parent::save();
$this->setredirect('ANY CUSTOM REDIRECT AS PER YOUR NEED', false));
}
This would sort out your issue

Monotouch.Dialog - How to push a view from an Element

It seems like this should be very easy, but I'm missing something. I have a custom Element:
public class PostSummaryElement:StyledMultilineElement,IElementSizing
When the element's accessory is clicked on, I want to push a view onto the stack. I.e. something like this:
this.AccessoryTapped += () => {
Console.WriteLine ("Tapped");
if (MyParent != null) {
MyParent.PresentViewController(new MyDemoController("Details"),false,null);
}
};
Where MyDemoController's gui is created with monotouch.dialog.
I'm just trying to break up the gui into Views and Controlls, where a control can push a view onto the stack, wiat for something to happen, and then the user navigates back to the previous view wich contains the control.
Any thought?
Thanks.
I'd recommend you not to hardcode behavior in AccessoryTapped method, because the day when you'll want to use that component in another place of your project is very close. And probably in nearest future you'll need some another behavior or for example it will be another project without MyDemoController at all.
So I propose you to create the following property:
public Action accessoryTapped;
in your element and its view, and then modify your AccessoryTapped is that way:
this.AccessoryTapped += () => {
Console.WriteLine ("Tapped");
if (accessoryTapped != null) {
accessoryTapped();
}
};
So you'll need to create PostSummaryElement objects in following way:
var myElement = new PostSummaryElement() {
accessoryTapped = someFunction,
}
...
void someFunction()
{
NavigationController.PushViewController (new MyDemoController("Details"), true);
}

Resources