Fixed filter operations after filter deletion (#1488832)

pull/66/head
Aleksander Machniak 12 years ago
parent 8beceebb55
commit da7905f9c6

@ -231,24 +231,31 @@ rcube_webmail.prototype.managesieve_updatelist = function(action, o)
// Delete filter row // Delete filter row
case 'del': case 'del':
var i, list = this.filters_list, rows = list.rows; var i = 0, list = this.filters_list;
list.remove_row(this.managesieve_rowid(o.id)); list.remove_row(this.managesieve_rowid(o.id));
list.clear_selection(); list.clear_selection();
this.show_contentframe(false); this.show_contentframe(false);
this.enable_command('plugin.managesieve-del', 'plugin.managesieve-act', false); this.enable_command('plugin.managesieve-del', 'plugin.managesieve-act', false);
// re-numbering filters // filter identifiers changed, fix the list
for (i=0; i<rows.length; i++) { $('tr', this.filters_list.list).each(function() {
if (rows[i] != null && rows[i].uid > o.id) // remove hidden (deleted) rows
rows[i].uid = rows[i].uid-1; if (this.style.display == 'none') {
} $(this).detach();
return;
}
// modify ID and remove all attached events
$(this).attr('id', 'rcmrow'+(i++)).unbind();
});
list.init();
break; break;
// Update filter row // Update filter row
case 'update': case 'update':
var i, row = $('#rcmrow'+o.id); var i, row = $('#rcmrow'+this.managesieve_rowid(o.id));
if (o.name) if (o.name)
$('td', row).html(o.name); $('td', row).html(o.name);

Loading…
Cancel
Save