开发者

Delete list on last item remove with connected JQuery sortable and knockout

http://jsfiddle.net/U3Tvp/1/

Steps to Reproduce

Drag Temperature list item under Score List

Expected Behaviour

The now empty list where the temperature list item existed should be deleted, as the last element in the list has been removed.

Actual Behaviour

The empty 开发者_高级运维list remains in the GUI.


One option would be to put a visible binding on the category template like:

<script id="obsGroupCatTmpl" type="text/html">
    <div style="float: left;" data-bind="visible: ObservationGroups().length">

Not sure if you actually need category removed or if hiding it is sufficient. If necessary, you could setup a manual subscription to each observableArray of ObservationGroups in the category object. If the array gets to the point where it is empty, then you could remove it completely from the ObservationGroupCategories array.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜