PDA

View Full Version : Using flexmenu with Knockout js



ojm37a
05-20-2015, 09:47 PM
I'm attempting to use flexmenu with knockout and something is not working. I have a knockout view that accepts a json array of items. In the view, there's a link that I'm trying to populate with the flexmenu dropdown like this:


<a href="#"
data-bind="attr: {'data-flexmenu': 'menu_' + id}">
Share this Post
</a>
<ul data-bind="attr: {id:'menu_'+ id }" class="flexdropdown">
<li data-bind="text: id"></li>
<li data-bind="text: post_url"></li>
<li data-bind="text: organization_name"></li>
</ul>

All seems to go well (the id's of the ul's are set to "menu_1", "menu_2", etc. and the href's have their data-flexmenu attributes set to "menu_1", "menu_2", etc.) until you hover over the anchor tag. The left and top are being set to values that place the menu off-screen. Seems like knockout is setting the position of the anchors after flexmenu reads them? OR?

Ideas how I can fix this?
TIA,
ojm

Beverleyh
05-21-2015, 07:47 AM
Warning: Please include a link to the DD script in question in your post. See this thread (http://www.dynamicdrive.com/forums/showthread.php?t=6) for the proper posting format when asking a question.

Please post a link to the page on your site that contains the problematic script so we can check it out.

In order to facilitate helpful responses, you need to provide more information.

If flexmenu is a DD script, you should provide the full name and a link to the demo page here on DD. See this thread for the proper posting format: http://www.dynamicdrive.com/forums/showthread.php?t=6

You should also provide a link to knockout and a link to part(s) of the documentation that are pertinent to your question. A knockout user may be able to help you (although I can't say I've personally heard any of the regular coders here mention it), or the syntax may be familiar enough that a non-knockout user can make useful suggestions too.

We also need a link to your page to give us something to troubleshoot from. We need to see the exact setup you describe but additionally, there may be other scripts causing conflicts or other factors that have been overlooked.

Once you have provided all the above information, someone with appropriate knowledge may be able to help.

ojm37a
05-22-2015, 02:21 PM
Ahh, yes. Sorry. Turns out Knockout and flexmenu are working just fine. When I distilled the code down to a simpler example, everything works. There's some conflict in the very large code-base that I haven't found yet... Can't really post that much code (mixture of c#, vb, js, jquery, black cats, eye of newt...).

Thanks anyway. I'll post better questions in the future, if needed.

--ojm