I'm using twitter bootstrap, knockout, knockout-sortable, and JQuery UI (also haml but it's inconsequential to the question). I display a tabbed list like the following. It adds a final tab with a button inside.
%ul.nav.nav-tabs
/ko foreach: pages
%li
%span{ "data-bind" => "text: name()" }
/ /ko
%li
%button.btn
%i.icon-plus
I'm trying to make the tabs sortable (via dragging) but I'm running into problems with the button:
%ul.nav.nav-tabs{ "data-bind" => "sortable: pages" }
%li
%span{ "data-bind" => "text: name()" }
/%li
/ %button.btn
/ %i.icon-plus
I can't use /ko sortable: pages
because it doesn't work (The binding 'sortable' cannot be used with virtual elements
). How can I achieve the same effect (last tab being a button) with sortable? Can't move the final tab/button though.
The answer may not have to be adding a tab, it could be adding an element that appears at the end of the tabs.
Update:
JSFiddle: http://jsfiddle.net/pbNvz/6/