From 7c26dbd36fdfa4f2f70d878d420ee59ad5c2aaac Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 16 Jan 2015 03:50:40 -0500
Subject: [PATCH] Fix javascript error in "IE 8.0/Tablet PC" browser (#1490210)

---
 program/js/list.js |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/program/js/list.js b/program/js/list.js
index d54b59d..8072dd8 100644
--- a/program/js/list.js
+++ b/program/js/list.js
@@ -118,7 +118,7 @@
     row.onmousedown = function(e){ return self.drag_row(e, this.uid); };
     row.onmouseup = function(e){ return self.click_row(e, this.uid); };
 
-    if (bw.touch) {
+    if (bw.touch && row.addEventListener) {
       row.addEventListener('touchstart', function(e) {
         if (e.touches.length == 1) {
           self.touchmoved = false;
@@ -300,11 +300,13 @@
     if (row.className) domrow.className = row.className;
     if (row.style) $.extend(domrow.style, row.style);
 
-    for (var domcell, col, i=0; row.cols && i < row.cols.length; i++) {
+    for (var e, domcell, col, i=0; row.cols && i < row.cols.length; i++) {
       col = row.cols[i];
       domcell = document.createElement(this.col_tagname());
       if (col.className) domcell.className = col.className;
       if (col.innerHTML) domcell.innerHTML = col.innerHTML;
+      for (e in col.events)
+        domcell['on' + e] = col.events[e];
       domrow.appendChild(domcell);
     }
 
@@ -1035,7 +1037,7 @@
 /**
  * Unselect selected row(s)
  */
-clear_selection: function(id)
+clear_selection: function(id, no_event)
 {
   var n, num_select = this.selection.length;
 
@@ -1057,7 +1059,7 @@
     this.selection = [];
   }
 
-  if (num_select && !this.selection.length)
+  if (num_select && !this.selection.length && !no_event)
     this.triggerEvent('select');
 },
 
@@ -1110,7 +1112,7 @@
 
   if (!multiple) {
     if (this.selection.length > 1 || !this.in_selection(id)) {
-      this.clear_selection();
+      this.clear_selection(null, true);
       this.selection[0] = id;
       $(this.rows[id].obj).addClass('selected');
     }
@@ -1280,7 +1282,8 @@
  */
 scrollto: function(id)
 {
-  var row = this.rows[id].obj;
+  var row = this.rows[id] ? this.rows[id].obj : null;
+
   if (row && this.frame) {
     var scroll_to = Number(row.offsetTop),
       head_offset = 0;

--
Gitblit v1.9.1