For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub
- This topic has 9 replies, 2 voices, and was last updated 14 years, 4 months ago by
SonamGyato.
-
AuthorPosts
-
SonamGyatoMemberWayne,
If you remember, I dynamically create a list and intercept list-item clicks.
for each of the listitems, i used to add a HREF attribute and pass it to
one of my javascript functions.href=”javascript:onListSelect(‘ + i + ‘)
where i is the index into the list.
In 1.5, it seems to have changed.
<li id=”m1-app-listItem1″ class=”m1-first m1-last m1-clickable m1-highlight”
data-action-click-id=”action18″>in mobi – i set the action to a javascript function.
How can I get my functionality back.
March 23, 2012 at 6:03 pm #324589
support-michaelKeymasterI am updating the custom-list example for 1.5 compatibility. Interesting! Did we provide direction for using the href attribute in such a manner? I thought we obsolesced this approach in favor of actions quite some time ago. I think there may be an alt approach. I need to check with lead dev first. Will get confirmation on monday.
March 24, 2012 at 11:15 am #324601
SonamGyatoMemberMaybe – but it was working pre 1.5.
The big issue is that the list-item entry that was clicked on
needs to be passed to the callback function.March 26, 2012 at 5:00 am #324614
support-michaelKeymasterAs you have identified the href attribute is no longer generated in favor of a different internal implementation for actions.
Instead of generating the HTML <li> attribtue:
href="javascript:onListSelect(' + i + ')consider replacing the href with an attribute that contains the list-item’s index such as
data-list-index=" + i + "Then in the RunJS action for the list-items using a jquery snippet like this to look up the data-list-index attribute:
index = $(event.srcElement).attr('data-list-index');March 26, 2012 at 8:04 am #324625
SonamGyatoMemberFor others trying to get it working w/ 1.5.
Another change is that the element id
m1-???- (where ??? is your mobi page name)
has been renamed
m1-???-panel1-scroller
Also, the “event” object in the previous response is
a global variable.March 26, 2012 at 9:42 am #324627
SonamGyatoMemberI think this work fine…just small edits here and there.
One “problem” is that the action?? numbers seem to change everytime
i edit a mobi file.the problem is that these numbers are hardcoded in my custom.js file.
as in similar to
‘<li id=”m1-legs-listItem1″ class=”‘ + cssClassList + ‘” data-list-index=”‘ + i + ‘” data-action-click-id=”action18″‘ + ‘>’ …
so i have to go back and find the proper action?? from the app.html file and then change it in my custom.js file.
it would be nice for me not to do this manual and error prone process.
March 26, 2012 at 10:35 am #324633
support-michaelKeymasterA quick fix is to move your js code from the Run JS action editor into a custom function in your _custom.js file. Then in your Run JS action have a 1 liner that calls your function in _custom.js. This is how I almost always impl my javascript functionality as it is much easier to use the Debugger on _custom.js file, I can use much better web editor if I choose and my _custom.js file is never overwritten.
March 26, 2012 at 11:05 am #324636
SonamGyatoMemberIt’s manageable because once I stop editing the mobi files – the
action?? don’t change.A real frustrating bug with the emulator tool is – when i open
the storage Database editor and type in a SELECT query –
the tool crashes at SE.I’ve reported this before – it’s crashing when it tries to auto-complete
the word.Just turn the feature off!!!
Problem solved.
The whole dev environment gets frozen and have to restart everything.
March 26, 2012 at 11:18 am #324638
support-michaelKeymaster>I’ve reported this before – it’s crashing when it tries to auto-complete
the word.I opened a bug on previous report that running sql queries is slow. I don’t recall “crash” discussion (maybe my oversight) as that is a much different problem and gets P1 attention. Can you provide me a few more details about the structure of your DB?
I ran the StickyNotes demo provided in the Test Center and inspect its Local Storage sql db. It does not crash in my simple case. See screenshot below.
See attachment db-inspector.pngAttachments:
You must be logged in to view attached files.March 26, 2012 at 11:56 am #324640
SonamGyatoMemberit doesn’t happen always – but definitely by the 2nd or 3rd try.
i’ve got a single table.
select * from Owner;
if you can provide an option to disable this auto-complete feature –
maybe that’ll help me. -
AuthorPosts
