From 1094cda9a04bd52a06dd662bc5d648b4105cff1a Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Wed, 05 Sep 2007 02:53:53 -0400
Subject: [PATCH] Allso trigger events when selecting all/none list entries
---
program/js/list.js | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/program/js/list.js b/program/js/list.js
index c4f0240..6a083a2 100644
--- a/program/js/list.js
+++ b/program/js/list.js
@@ -422,7 +422,8 @@
if (!this.rows || !this.rows.length)
return false;
- // reset selection first
+ // reset but remember selection first
+ var select_before = this.selection.join(',');
this.clear_selection();
for (var n in this.rows)
@@ -434,7 +435,11 @@
}
}
- return true;
+ // trigger event if selection changed
+ if (this.selection.join(',') != select_before)
+ this.trigger_event('select');
+
+ return true;
},
@@ -443,14 +448,18 @@
*/
clear_selection: function()
{
- for(var n=0; n<this.selection.length; n++)
+ var num_select = this.selection.length;
+ for (var n=0; n<this.selection.length; n++)
if (this.rows[this.selection[n]])
{
this.set_classname(this.rows[this.selection[n]].obj, 'selected', false);
this.set_classname(this.rows[this.selection[n]].obj, 'unfocused', false);
}
- this.selection = new Array();
+ this.selection = new Array();
+
+ if (num_select)
+ this.trigger_event('select');
},
--
Gitblit v1.9.1