From 8bbb45452440746e43fca71d7f7a0f7369ad414e Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 14 Feb 2016 06:47:30 -0500
Subject: [PATCH] Fix list row selection when provided uid is number not a string
---
program/js/list.js | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/program/js/list.js b/program/js/list.js
index de2be7a..cc9de0a 100644
--- a/program/js/list.js
+++ b/program/js/list.js
@@ -1104,11 +1104,11 @@
/**
* Check if given id is part of the current selection
*/
-in_selection: function(id)
+in_selection: function(id, index)
{
for (var n in this.selection)
if (this.selection[n] == id)
- return true;
+ return index ? n : true;
return false;
},
@@ -1256,18 +1256,19 @@
}
}
else {
- if (!this.in_selection(id)) { // select row
+ var pre, post, p = this.in_selection(id, true);
+
+ if (p === false) { // select row
this.selection.push(id);
$(this.rows[id].obj).addClass('selected').attr('aria-selected', 'true');
if (!norecur && !this.rows[id].expanded)
this.highlight_children(id, true);
}
else { // unselect row
- var p = $.inArray(id, this.selection),
- a_pre = this.selection.slice(0, p),
- a_post = this.selection.slice(p+1, this.selection.length);
+ pre = this.selection.slice(0, p);
+ post = this.selection.slice(p+1, this.selection.length);
- this.selection = a_pre.concat(a_post);
+ this.selection = pre.concat(post);
$(this.rows[id].obj).removeClass('selected').removeAttr('aria-selected');
if (!norecur && !this.rows[id].expanded)
this.highlight_children(id, false);
--
Gitblit v1.9.1