diff options
author | Aleksander Machniak <alec@alec.pl> | 2012-11-27 19:31:57 +0100 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2012-11-27 19:31:57 +0100 |
commit | da7905f9c6a4038e22486442a81261c98b35cfe8 (patch) | |
tree | 4ae1b0b1e71f0a9f1f6fe160cc537f1187899c07 /plugins | |
parent | 8beceebb55294cbb65d597d5e3924b2bc5d2689f (diff) |
Fixed filter operations after filter deletion (#1488832)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/managesieve/managesieve.js | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/plugins/managesieve/managesieve.js b/plugins/managesieve/managesieve.js index 6bf99ac26..5404a6d1a 100644 --- a/plugins/managesieve/managesieve.js +++ b/plugins/managesieve/managesieve.js @@ -231,24 +231,31 @@ rcube_webmail.prototype.managesieve_updatelist = function(action, o) // Delete filter row 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.clear_selection(); this.show_contentframe(false); this.enable_command('plugin.managesieve-del', 'plugin.managesieve-act', false); - // re-numbering filters - for (i=0; i<rows.length; i++) { - if (rows[i] != null && rows[i].uid > o.id) - rows[i].uid = rows[i].uid-1; - } + // filter identifiers changed, fix the list + $('tr', this.filters_list.list).each(function() { + // remove hidden (deleted) rows + if (this.style.display == 'none') { + $(this).detach(); + return; + } + + // modify ID and remove all attached events + $(this).attr('id', 'rcmrow'+(i++)).unbind(); + }); + list.init(); break; // Update filter row case 'update': - var i, row = $('#rcmrow'+o.id); + var i, row = $('#rcmrow'+this.managesieve_rowid(o.id)); if (o.name) $('td', row).html(o.name); |