I'm building an app with Ionic 2 and my question relates the navigation, it is not easy to explain but I'll try:
I have a page (MyFilePage), with a list of files from a cloud, in which I recall the navCtrl.push() on it, for recursive navigation in folders. On this page I have an ion-fab button who sends me, with push(), to another page (UplaodPage), with the list of file in the memory's device. In this page I recall the method push() on it, as the other page, for recursive navigation in folders. After that I select the file I want to upload, and what I would to do, is return to the last MyFilePage visited, (the one where I make the uplaod).
I post an image, ionic 2 app strucure , that may clarify the situation.
Thanks
EDIT:
This works nice on Ionic 2 with the method push(page: any, params?: any, opts?: NavOptions, done?: Function);, but not in Ionic 3, that have the method push(page: Page | string, params?: any, opts?: NavOptions, done?: Function): Promise;, where page is type of Page|string and the method getByIndex() returns a ViewController.
Anyone have a solution? Thanks
If you want to keep pages:
1- first you need to get the index of the page you want to back to and save in a provider(recommended) or storage.
let index = this.navCtrl.indexOf(this.navCtrl.getActive());
2- then you can go to the saved page like this:
let selectedPage = this.navCtrl.getByIndex(index);
this.navCtrl.push(selectedPage );
and if you like to remove those pages:
1- first you need to get the index of the page you want to back to and also a counter when ever you push a page. then save them in a provider(recommended) or storage.
2- then you can go to the selected page and remove the other like this:
this.navCtrl.remove(startIndex+1, removeCount);
for more info check NavController.
Related
I am making a validation form in a stepper format in flutter. Each step has a validation form.
When first opening the page, there is only one step. I want the user to click continue and get one more stepper (i.e Step 2 and get one more step by clicking continue in step 2.)
I have tried to change the number of steps by adding one more step to the list and updating when changeCurrentStepContinue is called, but it can't increase the number of steps showing error. On going back and again going forward, I get the updated list.
So how can I change the number of steps on the same page by clicking continue in each step?
I don't know how "good" my trick is, but I just change the Key of the Stepper by adding the total amount of items in the list I'm binding to.
return Stepper(
key: Key("mysuperkey-" + items.length.toString()),
...
);
This should create a new Stepper when the total of step changes.
Cheers
Its not possible as per comment in stepper.dart that says /// The length of [steps] must not change. but I'd made some edits that works fine for vertical stepper.
Follow this steps to apply that patch into your flutter code
cd to flutter directory
download this file 0001-Made-Stepper-Stepper-Size-Dynamic.patch and keep it in flutter folder
In your terminal $ git apply 0001-Made-Stepper-Stepper-Size-Dynamic.patch
OR
Replace _buildVertical() in /flutter/packages/flutter/lib/src/material/stepper.dart with this function
I am pretty new to react native and not sure how to handle my approach here. I have this screen.
I want to enter points and when I click on plus or minus I want to have a record of these points in the view above.
What is the best way to handle this? I thought about making an array of textboxes and push them in every time I hit a button but I don't know where to store the array without global scope. Or I save everything in Redux but I think it doesn't make sense to put everything into Redux.
Would be happy about a suggestions, thanks :)
Project is on github: https://github.com/AlessandroVol23/Counter10000
Let's see if my idea can be helpful.
If I understood what you mean, you would like to store points that you're introducing when you click the + button and show them in the view. Also, my question is: Would you also like to show the points every time you go back to this view?
If so, my approach would be:
Storing points in an array and then save it in the redux store (This will allow you to show your points when you visit this view again)
const numbers = [40, 30, 50, 99]
Then inside the component, you only need to go through this array with a map and show the list. Something like:
const numbers = [1, 2, 3, 4, 5] -> This comes from the redux store
const listItems = numbers.map((number) =>
<li>{number}</li>
);
listItems will contain a list of number that you can then render inside the component.
Before a user clicks on dropdown
When user click on the dropbox value, my android apps will display a table below with content accordingly, like showing up the table Guest Information&payment as shown in the following image.
Please give me some ideas how to do it.
I found the answer.
First, set the state like this.setState({guestInfoTable : <View> Content </View>})
And then, add { this.state.guestInfoTable } in render function and it works for me! Thanks for viewing.
I'm a beginner at App Inventor and I don't know what I'm doing wrong with the listpicker.
I am trying to create and app to reproduce the music I have stored in my server but when i display the listpicker I can't click any of the options and also I can't go back to the first screen. Here I put my code:
Image 1
Image 2
I tried to remove the line that says call listpicker.open but it only made appear a totally black screen.
The result of the code I just posted is exactly what I spect a list with the name and the link of the 2 songs I already upload to my server but when I click them it didn't do anything.
Thanks for your help.
The Web component works asynchronously, which means, it takes a little bit, until the result is available. The result you will get in the Web.GotText event.
Therefore it does not make sense to call the updateListpicker procedure in the Listpicker.BeforePicking event, because the result still is not available and you get displayed an empty listpicker. The listpicker will be opened, before you have received the result!
Set the listpicker to visible=false and use a button.click event to call the updateListpicker procedure. Then as you already do it in the Web.GotText event, assign the received list to the listpicker and open it.
I am developing a sample app using phonegap with the jQuery mobile plugin for android. I created a page, main.html. From main.html, I am able to catch the event. Once button is pressed in the main page, I change the contents using( $.mobile.changePage("path") ) function to signup.html. I have button in signup.html but when I click that button click event does not get fired. I have loaded all the js file in signup.html as well. what am doing wrong? Please guide me.
Clarification: Should I keep only one html (main.html ) and through that I have to do page navigation.?
In case your second page javascript is placed inside a HEAD content
If I understood you correctly, you are using ajax to load this page into the DOM? If this is true then I understand your problem. You see, when ajax is used for page loading only BODY content is loaded into the DOM.
You can fix your problem if you initialize your second html page javascript inside a first HTML file or move your SCRIPT block inside a second HTML BODY content.
Also, I have described this problem in my other ARTICLE with more details and few examples, or it can be found HERE.
In case you have several buttons with a same id
This could also be a little different problem. You see, if you have 2 buttons with a same id, they are both inside a DOM structure. If you try to bind a click event on a second page button, that same event will be bound to the button on a first page. Because they have a same id jQuery will bound an event to the first button (with that id) found in the DOM.
To fix this problem you need to use a jQM constructor called active page. One more warning, next code example will work only in a page events initialized after a pageinit event, for example pagebeforeshow or pageshow events:
$(document).on('pagebeforeshow', '#yourPageID', function(){
// Registering button click
$(document).on('click', $.mobile.activePage.find('#myButtonID'), function(){
// Do something
});
});
This line of code:
$.mobile.activePage.find('#myButtonID')
Will only get button '#myButtonID' found in a current active page, no matter how many other buttons with a same id exist inside the DOM.
Answer to the last question
About your last questions. It doesn't matter which template structure you use (1 HTML with multiple pages or multiple HTML's), you just need to worry about things I mentioned before.
Did you wrap your code inside following snippet?
$(document).on('pagebeforeshow', '#yourPageID', function(){
// Registering button click
$('#myButtonID').bind('click',function(){
$.mobile.changePage('yourfile.html');
});
});
if you just wrap it inside your <script></script> tag the event will not fire.
Did you get any error in the console? Check DDMS for it.