Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Item is getting destroyed when dropped over #154

Open
xaviergxf opened this issue Jan 19, 2016 · 1 comment
Open

Item is getting destroyed when dropped over #154

xaviergxf opened this issue Jan 19, 2016 · 1 comment

Comments

@xaviergxf
Copy link

Hi,

I'm having a little problem with knockout-sortable: when an item is dragged and dropped into another(try dragging the last item into the first one) the item dragged gets destroyed.

Here's my source code:

<!-- ko with: $data.ParentMetadataField ? $data: $.extend($data, {ParentFieldName:$module.GetParentFieldName($data)}) -->
<div class="navbar navbar-default" role="navigation">
    <div class="collapse navbar-collapse navbar-ex1-collapse">
        <ul class="nav navbar-nav" data-bind="sortable:{data:$module.GetItems(Model, ParentFieldName), template: '9612DDCC02C84BCCBAE864BC93AF9D86'}"/>
    </div>
</div>
<!-- /ko -->
<script id="9612DDCC02C84BCCBAE864BC93AF9D86" type="text/html">
<li data-bind="css:{'menu-item':true, dropdown:true, 'dropdown-submenu':!$parent.Model}">
    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
        <!-- ko text: $root.ToString(Title) --><!--/ko-->
        <!-- ko if: $parent.Model -->
            <b class="caret"></b>
        <!--/ko-->
    </a>
    <ul class="dropdown-menu" data-bind="sortable:{data:$module.GetItems($component.Model, $component.ParentFieldName, $data.ID()), template: '9612DDCC02C84BCCBAE864BC93AF9D86'}"/>
</li>
</script>

I'm using jQuery v2.1.4, jQuery UI Sortable 1.11.4 and ko v3.4.0

Can you help me?

Thanks!

@xaviergxf
Copy link
Author

It seems the problem has something to do with the first ul class navbar-nav. If we remove this class the example works. Perhaps something to do with its position?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant