Skip to content

Draggable Incorrectly calls template init/update #186

@rposener

Description

@rposener

When using draggable binding, it incorrectly uses template binding, but does not need to control the contents. This becomes an issue as it changes the context, and removes named items. Consider this example:

<tbody data-bind="foreach:{data:staff, as:'st'}">
    <tr>
        <th data-bind="text:st.Name"></th>
        <!-- ko foreach:{data:weeks, as:'wk'} -->
        <td data-bind="droppable:$component.dropTo.bind($component, {staff:st, week:wk})">
            <div data-bind="draggable:{staff:st, week:wk}">
                <span data-bind="text:$component.getCell.bind($component, {staff:st, week:wk})"></span>
            </div>
        </td>
        <!-- /ko -->
    </tr>
</tbody>

The span in here does not work, due to the template use in the draggable. I cannot see a valid reason for it in other cases. Will submit a pull request with this change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions