- This topic has 13 replies, 3 voices, and was last updated 9 years, 11 months ago by Brandon Batie.
-
AuthorPosts
-
merhebmMemberHello
I am creating dynamically a listitem by cloning a parent listitem.
in the parent lsititem i have an action : go to Screen xx.mobi
can you please tell me what action ID i should put instead of Z to go to a .mobi screen :
data-action-click-id=”actionZ”;same question if i want the action to go to a page (from multipage widget) within a .mobi screen?
Thanks
merhebmMemberDear Mobione Support Team
could you please take a look to my post and suggest a solution to me
Thanks
Brandon BatieMemberSorry about that. You could add an custom attribute to the HTML element then replace the go to a mobi screen with a run JS action, then use the JS to run the phoneui.gotoScreen() passing the ID. I don’t think I have a snippet around for it, but if you get stuck post what you have and we will try to get it figured out.
Darshan PatelParticipantit is possible!!
you’ll have to go other way round…
merhebmMemberHi
this is the code i am usinglist.append(
‘<li id=”m1-Multipages-listItem1″ class=”‘ + cssClassList + ‘”‘ +
‘ data-action-click-id=”action0″ data-listitem-index=”‘ + j + ‘”>’+
‘ <div id=”m1-Multipages-listItem1-inner-div”>’+
‘ <img id=”m1-Multipages-accessoryImage1″ class=”m1-clickable” ‘+
‘ src=”res/images/tableRowDisclosureIndicator.png”/>’+
‘ <div id=”m1-Multipages-_item” class=”m1-text”>’ + Labl + ‘</div>’+
‘ </div>’+
‘</li>’);instead of action0 , i want to be able to go to Screen, or go to a page of a Multipage widget.
can you tell me how to do it as i am blocked at this stagethanks
Brandon BatieMemberHi,
Something like this should work, create a new action like so:
function gotoDynamicScreen()
{
phoneui.gotoScreen(myScreenVariable);
}Then in your list item you can point the on click to this action. Then just programmatically set the myScreenVariable to your screen you want to go to. When ever an item it clicked it will call this function and go to the screen you set.
merhebmMemberHi Brandon
I have tried this in a new .mobi project and it worked with “action0” in the html code.
however when i go back to my real project and do the same scenario, it is not working and my guessing is that “action0” now does not refer to the JS on click function.
so my question to you, how can i know what is the number of the JS action on click i have configured for the list item, for example “action12”, or “action20”, or “action7” etc… in the html code i have shared in the beginning of this thread.
i need help on how to be able to call the JS function from inside the html code, symbolized by “ActionX”
Thanks
Brandon BatieMemberIts best not to use the actionXX, are generated by the code editor and may change so they are not reliable to use. The list items will call the actionXX, but the XX may change, which is why it didn’t work in the other project. So its best to use a custom function, ideally in the custom_xx.js file and point the list items to that as mentioned.
So for example, you can create a function that checks the index value of the list you are configuring, and based on that go to a specific screen.
Darshan PatelParticipantyes, just call the same function everytime and choose the screen on the basis of “data-listitem-index”
merhebmMemberGuys
I am blocked and not been able to translate your hints, I need a piece of code please to correct the below so that it can work, suppose the function to be called when click on a list item is xzxzxzx ().
can you tell me in the below code or in .js file or _custom.js file what should i correct or write ?list.append(
‘<li id=”m1-Multipages-listItem1″ class=”‘ + cssClassList + ‘”‘ +
‘ data-action-click-id=”action0″ data-listitem-index=”‘ + j + ‘”>’+
‘ <div id=”m1-Multipages-listItem1-inner-div”>’+
‘ <img id=”m1-Multipages-accessoryImage1″ class=”m1-clickable” ‘+
‘ src=”res/images/tableRowDisclosureIndicator.png”/>’+
‘ <div id=”m1-Multipages-_item” class=”m1-text”>’ + Labl + ‘</div>’+
‘ </div>’+
‘</li>’);Thanks
Brandon BatieMemberHi,
I think I see your issue. You would not change that code, you would set your list item to call that action. So in Mobione, click on your list item, use the On Click action to Run Javascript and put in your action. You then need to open your index js file and find the actions at the end to see which one calls your function (you should see it in there). Then use that action in the append code. Hopefully this will clear it up some. Let me know if you need further assistance.
merhebmMemberHi brandon
I have done this, it did not work still
this is my observation why:
I have 3 .mobi files, they are generating 3 .js files , in each one of those files the same action I am calling, it is having 3 different action numbers : action133 and action 190 and action 168I even tried to put the 3 action indexes in the list.append function but none of them worked
Can you figure out more and help me please
Thanks
merhebmMemberHi brandon
I have resolved the issue of the 3 different action numbers for same function, reason was that i was trying to run the web simulator from different .mobi of my project as being the startup page.
I have corrected this now and am using one single page to run the simulator and generate the index .js file.
I have now one action unique ID for the javascript function to be called from list item, however it is still not working.I am blocked now, i spent the whole past week working on this without success
all my code seems to be correct but still not making it workplease help me , I am in bad situation
thanks
Brandon BatieMemberHi,
If you have the correct actionxx to call but its still not working there could be a issue somewhere else. You can open the app in a debugger and paste in the console log errors we can help you try and see that the issue may be.
-
AuthorPosts