javascript - Strange behavior to searchable JQuery Connected Sortable. Need fix -
i using connected sortable saves wonderfully via asp.net back-end on button click. additional features include ability search each of lists. works until drop , drag of item 1 list another. when search of 1 list using javascript search items in 1 list, still thinks part of first list. has seen behavior? , know of possible fix make item permanently part of said dragged upon list within dom. behavior in ff, ie, chrome, etc.
now have buttons on list move items 1 list other based on them being selected button clicked, part of second list using jquery append();. makes item permanent part of second list's dom , able searched upon within list.
so here "ah-ha" moment. doing supposed looking item , showing , if not item wouldn't show it. when item moved other column using sortable still had same class first column. needed make switch.
the answer here follows... http://jsfiddle.net/6jmlvysj/
$(input) .change(function () { var filter = $(this).val(); if (filter) { //here dah moment looking class when user typing in first search input looking item searching second column--give myself gib slap-- $(list).find(".ui-state-default:not(:contains(" + filter + "))").hide(); $(list).find("ui-state-default:contains(" + filter + ")").show(); } else { $(list).find(".ui-state-default").show(); } return false; }) .keyup(function () { $(this).change(); });
then this
//so here changed code when user brings item on changes proper respected class depending user drops can searched. stop: function (event, ui) { if (ui.item.hasclass("ui-state-default")) { ui.item.attr('class', 'ui-state-highlight'); } else { ui.item.attr('class', 'ui-state-default'); }
Comments
Post a Comment