1
0
Fork 0
forked from OpenNeo/impress

fun hacks to persist checkboxes after all hangers update

This commit is contained in:
Matchu 2015-09-26 15:04:59 -07:00
parent 48185fd5b8
commit 776b2e864a

View file

@ -372,6 +372,20 @@
$('.bulk-actions-target-count').text(checkedCount); $('.bulk-actions-target-count').text(checkedCount);
} }
function maintainCheckboxes(fn) {
var checkedIds = [];
getCheckboxes().filter(':checked').each(function() {
if (this.checked) checkedIds.push(this.id);
});
fn();
checkedIds.forEach(function(id) {
document.getElementById(id).checked = true;
});
updateBulkActions();
}
/* /*
Search, autocomplete Search, autocomplete
@ -412,8 +426,10 @@
}, },
success: function (html) { success: function (html) {
var doc = $(html); var doc = $(html);
hangersEl.html( doc.find('#closet-hangers').html() ); maintainCheckboxes(function() {
hangersInit(); hangersEl.html( doc.find('#closet-hangers').html() );
hangersInit();
});
doc.find('.flash').hide().insertBefore(hangersEl).show(500).delay(5000).hide(250); doc.find('.flash').hide().insertBefore(hangersEl).show(500).delay(5000).hide(250);
itemsSearchField.val(""); itemsSearchField.val("");
}, },