- This topic has 11 replies, 3 voices, and was last updated 10 years, 1 month ago by Philip!!!.
-
AuthorPosts
-
Philip!!!MemberHi
Is it possible you guys to add an option to the combo box widget so we can choose the permanent title of the combo box?
for example, i want to add a combo box to my home screen and name it “menu”, so after i navigate in my app and then return to my home screen it will not display the name of the page i last visit, but its title … “menu”.
support-octavioMemberHi philip,
I am kind of confused with your question. Does your app navigate to secondary screens depending on selected combobox option? If yes, you can add the code to “reset” your combobox, see this thread: http://www.genuitec.com/support-genuitec/viewtopic.php?f=8&t=3820
After modifying the snippet you can add it to your phoneui.postPageTransition function in the <project>_custom.js file.
Let me know if you need further assistance.
Code_AMemberI think I might be confused. Why is your combobox displaying the last page you visited? Is this the selected value in the combobox?
If you want a permanent title, then you can place a label above it. If you want to clear the combobox selection then you can handle that programmatically. Is that what you are trying to do?
Philip!!!MemberOk
take a look at the screenshots .
the first label is menu , because i want my user to know that this is the menu of my app.
then i want to navigate at page one, so i choose from my combo box
“PAGE 1” and i navigate at page 1.then when i go back to my home screen in the combo box is “PAGE 1”
but i want it to display “MENU” again.
i hope i explain it better this time.
Attachments:
You must be logged in to view attached files.
Code_AMemberTry using this code on your page transition back to home (index being the number of the item you want to select):
$('select[name="combobox1"] option:eq(index)').attr('selected','selected')
Philip!!!MemberI am not sure i am following you because i am new to this.
where do i add the code?
Can i add it in to my project js file?->index being the number of the item you want to select
I don’t understand that at all .
What item i want to select?Thank you for your time and effort
support-octavioMemberHi philip,
Can you share the code you are using to navigate between screens? Seeing it will allow us to provide better advice.
Philip!!!MemberHi Octavio.
I am using this code:
var pageId = $(‘select[name=”combobox1″]’).val();
phoneui.gotoPage(pageId, ‘FADE’);I followed this tutorial to implement:
https://www.youtube.com/watch?v=U2ujNBpw34Aas you will notice at the tutorial as well when he returns to his home screen
the combo box displays the name of the screen he last visit.
support-octavioMemberHi Philip,
As Code A suggested you can use that snippet in the phoneui.postPageTransition function in the _custom.js file:
$('select[name="combobox1"] option:eq(0)').attr('selected','selected') //used 0 as index assuming your MENU label is the first one. phoneui.preprocessDOM('#screen-name'); //force UI to update
Philip!!!MemberHi Octavio
It doesn’t work , probably i am doing something wrong.
is this how i am suppose to add the code?:phoneui.postPageTransition = function(newScreenId) {
localStorage.setItem(“lastscreen”,”products”);
$(‘select[name=”combobox1″] option:eq(0)’).attr(‘selected’,’selected’)
phoneui.preprocessDOM(‘#screen-name’);
}
support-octavioMemberHi philip,
You have to use your screen id:
@philip wrote:option:eq(0)’).attr(‘selected’,’selected’)
phoneui.preprocessDOM(‘#screen-name‘);
}Example:
phoneui.preprocessDOM('#m1-home');
Philip!!!MemberHi Octavio
It worked.
-
AuthorPosts