0

I am trying to make a simple nested list (jQuery Mobile) get filled by knockout.js The data is a simple JSON hierachy.

Please check http://jsfiddle.net/RYLve/

The parent item is displayed but it is not navigable. What's wrong?

Thanks!

1 Answer 1

1

There are two main issues I think you are facing:

1) Make sure you use <span data-bind="text: Name"></span> rather than <span data-bind="text: Name" />

2) There are timing issues with the automatic processing of the listviews. You can resolve this by using a custom binding to add the data-role and process the element.

I'm not sure if it is perfect, and I still see funny binding errors, but this fiddle seems closer to what you are looking for: http://jsfiddle.net/RYLve/1/

Hopefully this will help you.

EDIT: I've enhanced my fiddle and I think everything is now working. I switched to using a template so you can get full heirarchies. Also note that I use setTimeout to allow the DOM time to populate before attempting to invoke listview.

http://jsfiddle.net/RYLve/2/

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks. I also think there are some problems with the way knockout interacts with jquery mobile but I just don't see how to fix it.
do you see a work around? I just want to use the MVVM with knockout to show a tree hierarchy with listviews. Maybe I can use something else instead of the nested list mechanism of jQuery mobile. maybe just listviews and have the pages showing child listviews separated or generated on the fly, not sure
Take a look at my last fiddle. You can drill into Item 1, and then into Item 1.2 to see three levels of hierarchy. Since I use a template there is theorhetically no limit to the levels you can render.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.