1

After rendering tables using knockout, I use slick carousel to create slide transitions. The problem is that the knockout click binding stops working when I click on the slide. Attaching part of the code for reference.

<div data-bind="foreach : $root.AllPackages()" class="row plans-content">
<div class="table-responsive">
    <table class="plans-content-table">
        <tbody>
            <!-- ko foreach: Object.keys(WidgetPacks) -->
            <!-- ko foreach: $parent.WidgetPacks['default'] -->
            <tr>
                <td colspan="2">
                    <p>
                        <span class="tooltip" data-bind="attr:{'title': Desc}">
                        <span data-bind="text:Name"></span>
                        <br />
                    </p>
                </td>
            </tr>
            <!--/ko-->
            <tr data-bind="$if:$data!=null && $data!='default', visible:$data!=null && $data!='default'">
                <td>
                    <p data-bind="text:$data"></p>
                </td>
            </tr>
            <!-- /ko -->
            <tr>
                <td colspan="2" class="text-center">
                    <span class="btn btn-lg yellow-btn-pricing-plan">
                        <a data-bind="click: $root.CheckoutPlans" class="btn btn-yellow btn-md">
                             Purchase a Plan
                        </a> 
                    </span>
                </td>
            </tr>
        </tbody>
    </table>
</div>

Creating the slick carousel:

$('.plans-content').slick({
            adaptiveHeight: true,
            slidesToShow: 3,
            slidesToScroll: 3,
            initialSlide: 0
        });
        $('.plans-content').slick("refresh");
  • 1
    view this https://stackoverflow.com/questions/29657897/slick-js-carousel-with-knockout-custom-binding?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – Shamse Alam Apr 25 '18 at 11:36
  • http://jsfiddle.net/jbustos/sktspj1w/ – Shamse Alam Apr 25 '18 at 11:38
  • The if and foreach binding is being correctly computed. Only the click binding does not apply. The slick initialisation is put on tab switch, so the table is already generated before slick carousel is being formed. – Rupali Bhatnagar Apr 25 '18 at 13:06
  • share JSfiddle link so that we can debug and fix the issue – Shamse Alam Apr 26 '18 at 07:03

0 Answers0