For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub
- This topic has 11 replies, 2 voices, and was last updated 11 years, 10 months ago by
jbgglgdev.
-
AuthorPosts
-
jbgglgdevMemberHi, maybe already discussed…
I would like to show a multipage when the toggle in On and when Off hide or show another multipage.
any help very welcome.
Regards
JBApril 23, 2014 at 6:13 pm #348973
Code_AMemberYou should be able to use the following code to accomplish this.
$('#m1-<screen>-multiPage1').show(); //show multipage widget $('#m1-<screen>-multiPage2').hide(); //hide multipage widgetApril 24, 2014 at 9:05 am #348988
jbgglgdevMemberHi and thank you for the help.
here is what I have :
multipage2 with 2 pages, page Video and page SpecsI added a toggle on multipage 2 and when toggle is off then video page should not show and when toggle is on video page should show.
Specs page is the multipage2 default page.So on the toggle code I have :
if ($(‘input[name=”toggle1″]’).is(‘:checked’)) {$(‘#m1-<screen>-multiPage2-Video’).show(); //show multipage widget
} else {
$(‘#m1-<screen>-multiPage2-Video’).hide(); //hide multipage widget
}
but it’s not working as expected…
JB
April 24, 2014 at 9:14 am #348989
Code_AMemberDid you replace <screen> with your mobi screen name?
April 25, 2014 at 4:42 am #348999
jbgglgdevMemberYes, I did that :
if ($(‘input[name=”toggle1″]’).is(‘:checked’)) {
$(‘#m1-Video-multiPage2’).show(); //show multipage widget
$(‘#m1-Specs-multiPage2’).hide(); //hide multipage widget
} else {$(‘#m1-Video-multiPage2’).hide(); //hide multipage widget
}
April 25, 2014 at 5:38 am #349001
Code_AMemberI assumed your multipage widgets were on the same screen. If they are not then that code will not work. Instead you would need to use gotoScreen to switch between the screens. Once you are on the right screen, then you should be able to show/hide the widget.
phoneui.gotoScreen("Specs"); phoneui.gotoScreen("Video");April 27, 2014 at 5:34 am #349043
jbgglgdevMemberI can not make it work… here is a simple toggle page…
what is wrong ?
thank you
JBAttachments:
You must be logged in to view attached files.April 27, 2014 at 6:05 am #349044
Code_AMemberI would like to show a multipage when the toggle in On and when Off hide or show another multipage.
Sorry, I thought that you were trying to toggle between two multipage widgets.
To toggle between pages within a multipage, you can use the following code (this works for the test project you posted):
if ($('input[name="toggle1"]').is(':checked')) { phoneui.gotoMultiPagePage('m1-test-toggle-multiPage1', 'SET_PAGE', 'm1-test-toggle-page1', 'NONE'); } else { phoneui.gotoMultiPagePage('m1-test-toggle-multiPage1', 'SET_PAGE', 'm1-test-toggle-page2', 'NONE'); }April 27, 2014 at 8:59 am #349045
jbgglgdevMembergreat, thank you ! it’s me that did not explain well 😉
I have probably done wrong as it is not working with my file…. see mobi
JB
Attachments:
You must be logged in to view attached files.April 29, 2014 at 2:52 am #349094
jbgglgdevMemberI have probably done wrong as it is not working with my file….
April 29, 2014 at 4:11 am #349097
Code_AMemberYour code is working but the problem is that you have two multipage widgets on the screen, so when you show the pages on the second mulitpage they are covered by the first multipage widget. You need to hide the first multipage before showing the second one.
Try this:
$('#m1-MoteurBoatVantage230-multiPage1').hide(); //hide multipage widget if ($('input[name="toggle1"]').is(':checked')) { phoneui.gotoMultiPagePage('m1-MoteurBoatVantage230-multiPage2', 'SET_PAGE', 'm1-MoteurBoatVantage230-page9', 'NONE'); } else { phoneui.gotoMultiPagePage('m1-MoteurBoatVantage230-multiPage2', 'SET_PAGE', 'm1-MoteurBoatVantage230-page10', 'NONE'); }Another, solution would be to put the pages from multipage2 into multipage1 and then you could use your existing code. Just drag and drop them from one to another to move them.
April 29, 2014 at 10:44 am #349107
jbgglgdevMemberok I understant better now, thank you very much for the help 😉
JB -
AuthorPosts
