Accordion jQuery UI control is not working when using knockoutJS..

1,313 views
Skip to first unread message

Nanid

unread,
Mar 1, 2012, 9:59:56 AM3/1/12
to KnockoutJS
Hi, I am using knockout with accordion and loading the accordion
dynamically. Here is my code. It's not working properly. By default
all the headers are expanded and even when I click on the header, they
are not collapsing..

<div id="accordion" class="ui-accordion">
<!-- ko foreach: FamilyControls -->
<h3 class="ui-accordion-header">
<span data-bind="text: Title"></span>
</h3>
<div class="ui-accordion-content">
<span data-bind="text: Description"></span>
</div>
<!-- /ko -->
</div>

$(".ui-accordion").accordion(
{
collapsible: true,
autoHeight: false
}
);

Need help in working this out.. Thank You..

rpn

unread,
Mar 1, 2012, 2:41:34 PM3/1/12
to knock...@googlegroups.com
Maybe you are calling .accordion, before ko.applyBindings?  Otherwise, can you reproduce based on this sample:  http://jsfiddle.net/rniemeyer/4xzxj/ ?

drventure

unread,
Jul 2, 2012, 11:24:00 PM7/2/12
to knock...@googlegroups.com
I'm having a similar problem, not quite the same but the Collapsible doesn't seem to work right when generated with Knockout.

I've put together a fiddle here

http://jsfiddle.net/5yA6G/1/

The first section is static and works fine.

The second is generated, and even with calling .collapsible after binding, the header is showing up twice, where it doesn't do that in the statically defined collapsible.

tobyq...@gmail.com

unread,
Dec 16, 2013, 4:44:33 PM12/16/13
to knock...@googlegroups.com, mahes...@gmail.com
I have a similar issue. $("#inputButton").bind("click", function (event)) doesn't bind unless I put a debug break point on it.

sir...@gmail.com

unread,
Mar 27, 2014, 1:08:27 PM3/27/14
to knock...@googlegroups.com, mahes...@gmail.com, tobyq...@gmail.com
My issue is similar to toby's

I have a similar issue. $("#inputButton").bind("click", function (event)) doesn't bind unless I put a debug break point on it

What to look for.
Reply all
Reply to author
Forward
0 new messages