|
|
@ -29,21 +29,20 @@ |
|
|
|
Desc : Programable sortable table |
|
|
|
Desc : Programable sortable table |
|
|
|
Licence : Open Source MIT Licence |
|
|
|
Licence : Open Source MIT Licence |
|
|
|
|
|
|
|
|
|
|
|
**************************************************************/ |
|
|
|
**************************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
var dynamicTable = new Class ({ |
|
|
|
var dynamicTable = new Class({ |
|
|
|
|
|
|
|
|
|
|
|
initialize: function(){ |
|
|
|
initialize : function () {}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setup: function(table, progressIndex, context_menu){ |
|
|
|
setup : function (table, progressIndex, context_menu) { |
|
|
|
this.table = $(table); |
|
|
|
this.table = $(table); |
|
|
|
this.rows = new Hash(); |
|
|
|
this.rows = new Hash(); |
|
|
|
this.cur = new Array(); |
|
|
|
this.cur = new Array(); |
|
|
|
this.priority_hidden = false; |
|
|
|
this.priority_hidden = false; |
|
|
|
this.progressIndex = progressIndex; |
|
|
|
this.progressIndex = progressIndex; |
|
|
|
this.filter = localStorage.getItem('selected_filter'); |
|
|
|
this.filter = localStorage.getItem('selected_filter'); |
|
|
|
if(!$defined(this.filter)) { |
|
|
|
if (!$defined(this.filter)) { |
|
|
|
this.filter = 'all'; |
|
|
|
this.filter = 'all'; |
|
|
|
} |
|
|
|
} |
|
|
|
this.context_menu = context_menu; |
|
|
|
this.context_menu = context_menu; |
|
|
@ -51,12 +50,12 @@ var dynamicTable = new Class ({ |
|
|
|
this.table.reverseSort = false; |
|
|
|
this.table.reverseSort = false; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
sortfunction: function(tr1, tr2) { |
|
|
|
sortfunction : function (tr1, tr2) { |
|
|
|
var i = tr2.getParent().sortedIndex; |
|
|
|
var i = tr2.getParent().sortedIndex; |
|
|
|
var reverseSort = tr2.getParent().reverseSort; |
|
|
|
var reverseSort = tr2.getParent().reverseSort; |
|
|
|
switch(i) { |
|
|
|
switch (i) { |
|
|
|
case 1: // Name
|
|
|
|
case 1: // Name
|
|
|
|
if(!reverseSort) |
|
|
|
if (!reverseSort) |
|
|
|
return tr1.getElements('td')[i].get('html').localeCompare(tr2.getElements('td')[i].get('html')); |
|
|
|
return tr1.getElements('td')[i].get('html').localeCompare(tr2.getElements('td')[i].get('html')); |
|
|
|
else |
|
|
|
else |
|
|
|
return tr2.getElements('td')[i].get('html').localeCompare(tr1.getElements('td')[i].get('html')); |
|
|
|
return tr2.getElements('td')[i].get('html').localeCompare(tr1.getElements('td')[i].get('html')); |
|
|
@ -69,21 +68,21 @@ var dynamicTable = new Class ({ |
|
|
|
case 8: // Down Speed
|
|
|
|
case 8: // Down Speed
|
|
|
|
case 9: // ETA
|
|
|
|
case 9: // ETA
|
|
|
|
default: // Ratio
|
|
|
|
default: // Ratio
|
|
|
|
if(!reverseSort) |
|
|
|
if (!reverseSort) |
|
|
|
return (tr1.getElements('td')[i].get('data-raw') - tr2.getElements('td')[i].get('data-raw')); |
|
|
|
return (tr1.getElements('td')[i].get('data-raw') - tr2.getElements('td')[i].get('data-raw')); |
|
|
|
else |
|
|
|
else |
|
|
|
return (tr2.getElements('td')[i].get('data-raw') - tr1.getElements('td')[i].get('data-raw')); |
|
|
|
return (tr2.getElements('td')[i].get('data-raw') - tr1.getElements('td')[i].get('data-raw')); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
updateSort: function() { |
|
|
|
updateSort : function () { |
|
|
|
var trs = this.table.getChildren('tr'); |
|
|
|
var trs = this.table.getChildren('tr'); |
|
|
|
trs.sort(this.sortfunction); |
|
|
|
trs.sort(this.sortfunction); |
|
|
|
this.table.adopt(trs); |
|
|
|
this.table.adopt(trs); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setSortedColumn: function(index) { |
|
|
|
setSortedColumn : function (index) { |
|
|
|
if(index != this.table.sortedIndex) { |
|
|
|
if (index != this.table.sortedIndex) { |
|
|
|
this.table.sortedIndex = index; |
|
|
|
this.table.sortedIndex = index; |
|
|
|
this.table.reverseSort = false; |
|
|
|
this.table.reverseSort = false; |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -94,85 +93,86 @@ var dynamicTable = new Class ({ |
|
|
|
this.altRow(); |
|
|
|
this.altRow(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getCurrentTorrentHash: function() { |
|
|
|
getCurrentTorrentHash : function () { |
|
|
|
if(this.cur.length > 0) |
|
|
|
if (this.cur.length > 0) |
|
|
|
return this.cur[0]; |
|
|
|
return this.cur[0]; |
|
|
|
return ''; |
|
|
|
return ''; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
altRow: function() |
|
|
|
altRow : function () { |
|
|
|
{ |
|
|
|
|
|
|
|
var trs = this.table.getElements('tr'); |
|
|
|
var trs = this.table.getElements('tr'); |
|
|
|
trs.each(function(el,i){ |
|
|
|
trs.each(function (el, i) { |
|
|
|
if(i % 2){ |
|
|
|
if (i % 2) { |
|
|
|
el.addClass('alt'); |
|
|
|
el.addClass('alt'); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
el.removeClass('alt'); |
|
|
|
el.removeClass('alt'); |
|
|
|
} |
|
|
|
} |
|
|
|
}.bind(this)); |
|
|
|
}.bind(this)); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
hidePriority: function(){ |
|
|
|
hidePriority : function () { |
|
|
|
if(this.priority_hidden) return; |
|
|
|
if (this.priority_hidden) |
|
|
|
|
|
|
|
return; |
|
|
|
$('prioHeader').addClass('invisible'); |
|
|
|
$('prioHeader').addClass('invisible'); |
|
|
|
var trs = this.table.getElements('tr'); |
|
|
|
var trs = this.table.getElements('tr'); |
|
|
|
trs.each(function(tr,i){ |
|
|
|
trs.each(function (tr, i) { |
|
|
|
var tds = tr.getElements('td'); |
|
|
|
var tds = tr.getElements('td'); |
|
|
|
tds[2].addClass('invisible'); |
|
|
|
tds[2].addClass('invisible'); |
|
|
|
}.bind(this)); |
|
|
|
}.bind(this)); |
|
|
|
this.priority_hidden = true; |
|
|
|
this.priority_hidden = true; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setFilter: function(f) { |
|
|
|
setFilter : function (f) { |
|
|
|
this.filter = f; |
|
|
|
this.filter = f; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
showPriority: function(){ |
|
|
|
showPriority : function () { |
|
|
|
if(!this.priority_hidden) return; |
|
|
|
if (!this.priority_hidden) |
|
|
|
|
|
|
|
return; |
|
|
|
$('prioHeader').removeClass('invisible'); |
|
|
|
$('prioHeader').removeClass('invisible'); |
|
|
|
var trs = this.table.getElements('tr'); |
|
|
|
var trs = this.table.getElements('tr'); |
|
|
|
trs.each(function(tr,i){ |
|
|
|
trs.each(function (tr, i) { |
|
|
|
var tds = tr.getElements('td'); |
|
|
|
var tds = tr.getElements('td'); |
|
|
|
tds[2].removeClass('invisible'); |
|
|
|
tds[2].removeClass('invisible'); |
|
|
|
}.bind(this)); |
|
|
|
}.bind(this)); |
|
|
|
this.priority_hidden = false; |
|
|
|
this.priority_hidden = false; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
applyFilterOnRow: function(tr, status) { |
|
|
|
applyFilterOnRow : function (tr, status) { |
|
|
|
switch(this.filter) { |
|
|
|
switch (this.filter) { |
|
|
|
case 'all': |
|
|
|
case 'all': |
|
|
|
tr.removeClass("invisible"); |
|
|
|
tr.removeClass("invisible"); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'downloading': |
|
|
|
case 'downloading': |
|
|
|
if(status == "downloading" || status == "stalledDL" || status == "checkingDL" || status == "pausedDL" || status == "queuedDL") { |
|
|
|
if (status == "downloading" || status == "stalledDL" || status == "checkingDL" || status == "pausedDL" || status == "queuedDL") { |
|
|
|
tr.removeClass("invisible"); |
|
|
|
tr.removeClass("invisible"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
tr.addClass("invisible"); |
|
|
|
tr.addClass("invisible"); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'completed': |
|
|
|
case 'completed': |
|
|
|
if(status == "uploading" || status == "stalledUP" || status == "checkingUP" || status == "pausedUP" || status == "queuedUP") { |
|
|
|
if (status == "uploading" || status == "stalledUP" || status == "checkingUP" || status == "pausedUP" || status == "queuedUP") { |
|
|
|
tr.removeClass("invisible"); |
|
|
|
tr.removeClass("invisible"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
tr.addClass("invisible"); |
|
|
|
tr.addClass("invisible"); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'paused': |
|
|
|
case 'paused': |
|
|
|
if(status == "pausedDL" || status == "pausedUP") { |
|
|
|
if (status == "pausedDL" || status == "pausedUP") { |
|
|
|
tr.removeClass("invisible"); |
|
|
|
tr.removeClass("invisible"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
tr.addClass("invisible"); |
|
|
|
tr.addClass("invisible"); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'active': |
|
|
|
case 'active': |
|
|
|
if(status == "downloading" || status == "uploading") { |
|
|
|
if (status == "downloading" || status == "uploading") { |
|
|
|
tr.removeClass("invisible"); |
|
|
|
tr.removeClass("invisible"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
tr.addClass("invisible"); |
|
|
|
tr.addClass("invisible"); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'inactive': |
|
|
|
case 'inactive': |
|
|
|
if(status != "downloading" && status != "uploading") { |
|
|
|
if (status != "downloading" && status != "uploading") { |
|
|
|
tr.removeClass("invisible"); |
|
|
|
tr.removeClass("invisible"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
tr.addClass("invisible"); |
|
|
|
tr.addClass("invisible"); |
|
|
@ -181,27 +181,32 @@ var dynamicTable = new Class ({ |
|
|
|
return !tr.hasClass('invisible'); |
|
|
|
return !tr.hasClass('invisible'); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
insertRow: function(id, row, data, status){ |
|
|
|
insertRow : function (id, row, data, status) { |
|
|
|
if(this.rows.has(id)) { |
|
|
|
if (this.rows.has(id)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
var tr = new Element('tr'); |
|
|
|
var tr = new Element('tr'); |
|
|
|
tr.addClass("menu-target"); |
|
|
|
tr.addClass("menu-target"); |
|
|
|
this.rows.set(id, tr); |
|
|
|
this.rows.set(id, tr); |
|
|
|
for(var i=0; i<row.length; i++) |
|
|
|
for (var i = 0; i < row.length; i++) { |
|
|
|
{ |
|
|
|
|
|
|
|
var td = new Element('td'); |
|
|
|
var td = new Element('td'); |
|
|
|
if(i==this.progressIndex) { |
|
|
|
if (i == this.progressIndex) { |
|
|
|
td.adopt(new ProgressBar(row[i].toFloat(), {'id': 'pb_'+id, 'width':80})); |
|
|
|
td.adopt(new ProgressBar(row[i].toFloat(), { |
|
|
|
|
|
|
|
'id' : 'pb_' + id, |
|
|
|
|
|
|
|
'width' : 80 |
|
|
|
|
|
|
|
})); |
|
|
|
if (typeof data[i] != 'undefined') |
|
|
|
if (typeof data[i] != 'undefined') |
|
|
|
td.set('data-raw', data[i]) |
|
|
|
td.set('data-raw', data[i]) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if(i==0) { |
|
|
|
if (i == 0) { |
|
|
|
td.adopt(new Element('img', {'src':row[i], 'class': 'statusIcon'})); |
|
|
|
td.adopt(new Element('img', { |
|
|
|
|
|
|
|
'src' : row[i], |
|
|
|
|
|
|
|
'class' : 'statusIcon' |
|
|
|
|
|
|
|
})); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if(i==2) { |
|
|
|
if (i == 2) { |
|
|
|
// Priority
|
|
|
|
// Priority
|
|
|
|
if(this.priority_hidden) |
|
|
|
if (this.priority_hidden) |
|
|
|
td.addClass('invisible'); |
|
|
|
td.addClass('invisible'); |
|
|
|
} |
|
|
|
} |
|
|
|
td.set('html', row[i]); |
|
|
|
td.set('html', row[i]); |
|
|
@ -212,17 +217,17 @@ var dynamicTable = new Class ({ |
|
|
|
td.injectInside(tr); |
|
|
|
td.injectInside(tr); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
tr.addEvent('mouseover', function(e){ |
|
|
|
tr.addEvent('mouseover', function (e) { |
|
|
|
tr.addClass('over'); |
|
|
|
tr.addClass('over'); |
|
|
|
}.bind(this)); |
|
|
|
}.bind(this)); |
|
|
|
tr.addEvent('mouseout', function(e){ |
|
|
|
tr.addEvent('mouseout', function (e) { |
|
|
|
tr.removeClass('over'); |
|
|
|
tr.removeClass('over'); |
|
|
|
}.bind(this)); |
|
|
|
}.bind(this)); |
|
|
|
tr.addEvent('contextmenu', function(e) { |
|
|
|
tr.addEvent('contextmenu', function (e) { |
|
|
|
if(!this.cur.contains(id)) { |
|
|
|
if (!this.cur.contains(id)) { |
|
|
|
// Remove selected style from previous ones
|
|
|
|
// Remove selected style from previous ones
|
|
|
|
for(i=0; i<this.cur.length; i++) { |
|
|
|
for (i = 0; i < this.cur.length; i++) { |
|
|
|
if(this.rows.has(this.cur[i])) { |
|
|
|
if (this.rows.has(this.cur[i])) { |
|
|
|
var temptr = this.rows.get(this.cur[i]); |
|
|
|
var temptr = this.rows.get(this.cur[i]); |
|
|
|
temptr.removeClass('selected'); |
|
|
|
temptr.removeClass('selected'); |
|
|
|
} |
|
|
|
} |
|
|
@ -234,28 +239,28 @@ var dynamicTable = new Class ({ |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
}.bind(this)); |
|
|
|
}.bind(this)); |
|
|
|
tr.addEvent('click', function(e){ |
|
|
|
tr.addEvent('click', function (e) { |
|
|
|
e.stop(); |
|
|
|
e.stop(); |
|
|
|
if(e.control) { |
|
|
|
if (e.control) { |
|
|
|
// CTRL key was pressed
|
|
|
|
// CTRL key was pressed
|
|
|
|
if(this.cur.contains(id)) { |
|
|
|
if (this.cur.contains(id)) { |
|
|
|
// remove it
|
|
|
|
// remove it
|
|
|
|
this.cur.erase(id); |
|
|
|
this.cur.erase(id); |
|
|
|
// Remove selected style
|
|
|
|
// Remove selected style
|
|
|
|
if(this.rows.has(id)) { |
|
|
|
if (this.rows.has(id)) { |
|
|
|
temptr = this.rows.get(id); |
|
|
|
temptr = this.rows.get(id); |
|
|
|
temptr.removeClass('selected'); |
|
|
|
temptr.removeClass('selected'); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.cur[this.cur.length] = id; |
|
|
|
this.cur[this.cur.length] = id; |
|
|
|
// Add selected style
|
|
|
|
// Add selected style
|
|
|
|
if(this.rows.has(id)) { |
|
|
|
if (this.rows.has(id)) { |
|
|
|
temptr = this.rows.get(id); |
|
|
|
temptr = this.rows.get(id); |
|
|
|
temptr.addClass('selected'); |
|
|
|
temptr.addClass('selected'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if(e.shift && this.cur.length == 1) { |
|
|
|
if (e.shift && this.cur.length == 1) { |
|
|
|
// Shift key was pressed
|
|
|
|
// Shift key was pressed
|
|
|
|
var first_id = this.cur[0]; |
|
|
|
var first_id = this.cur[0]; |
|
|
|
var first_tr = this.rows.get(first_id); |
|
|
|
var first_tr = this.rows.get(first_id); |
|
|
@ -264,13 +269,13 @@ var dynamicTable = new Class ({ |
|
|
|
var all_trs = this.table.getChildren('tr'); |
|
|
|
var all_trs = this.table.getChildren('tr'); |
|
|
|
var index_first_tr = all_trs.indexOf(first_tr); |
|
|
|
var index_first_tr = all_trs.indexOf(first_tr); |
|
|
|
var index_last_tr = all_trs.indexOf(last_tr); |
|
|
|
var index_last_tr = all_trs.indexOf(last_tr); |
|
|
|
var trs_to_select = all_trs.filter(function(item, index){ |
|
|
|
var trs_to_select = all_trs.filter(function (item, index) { |
|
|
|
if(index_first_tr < index_last_tr) |
|
|
|
if (index_first_tr < index_last_tr) |
|
|
|
return (index > index_first_tr) && (index <= index_last_tr); |
|
|
|
return (index > index_first_tr) && (index <= index_last_tr); |
|
|
|
else |
|
|
|
else |
|
|
|
return (index < index_first_tr) && (index >= index_last_tr); |
|
|
|
return (index < index_first_tr) && (index >= index_last_tr); |
|
|
|
}); |
|
|
|
}); |
|
|
|
trs_to_select.each(function(item, index){ |
|
|
|
trs_to_select.each(function (item, index) { |
|
|
|
// Add to selection
|
|
|
|
// Add to selection
|
|
|
|
this.cur[this.cur.length] = this.getRowId(item); |
|
|
|
this.cur[this.cur.length] = this.getRowId(item); |
|
|
|
// Select it visually
|
|
|
|
// Select it visually
|
|
|
@ -279,15 +284,15 @@ var dynamicTable = new Class ({ |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// Simple selection
|
|
|
|
// Simple selection
|
|
|
|
// Remove selected style from previous ones
|
|
|
|
// Remove selected style from previous ones
|
|
|
|
for(i=0; i<this.cur.length; i++) { |
|
|
|
for (i = 0; i < this.cur.length; i++) { |
|
|
|
if(this.rows.has(this.cur[i])) { |
|
|
|
if (this.rows.has(this.cur[i])) { |
|
|
|
var temptr = this.rows.get(this.cur[i]); |
|
|
|
var temptr = this.rows.get(this.cur[i]); |
|
|
|
temptr.removeClass('selected'); |
|
|
|
temptr.removeClass('selected'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.cur.empty(); |
|
|
|
this.cur.empty(); |
|
|
|
// Add selected style to new one
|
|
|
|
// Add selected style to new one
|
|
|
|
if(this.rows.has(id)) { |
|
|
|
if (this.rows.has(id)) { |
|
|
|
temptr = this.rows.get(id); |
|
|
|
temptr = this.rows.get(id); |
|
|
|
temptr.addClass('selected'); |
|
|
|
temptr.addClass('selected'); |
|
|
|
} |
|
|
|
} |
|
|
@ -301,11 +306,11 @@ var dynamicTable = new Class ({ |
|
|
|
this.applyFilterOnRow(tr, status); |
|
|
|
this.applyFilterOnRow(tr, status); |
|
|
|
// Insert
|
|
|
|
// Insert
|
|
|
|
var trs = this.table.getChildren('tr'); |
|
|
|
var trs = this.table.getChildren('tr'); |
|
|
|
var i=0; |
|
|
|
var i = 0; |
|
|
|
while(i<trs.length && this.sortfunction(tr, trs[i]) > 0) { |
|
|
|
while (i < trs.length && this.sortfunction(tr, trs[i]) > 0) { |
|
|
|
i++; |
|
|
|
i++; |
|
|
|
} |
|
|
|
} |
|
|
|
if(i==trs.length) { |
|
|
|
if (i == trs.length) { |
|
|
|
tr.inject(this.table); |
|
|
|
tr.inject(this.table); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
tr.inject(trs[i], 'before'); |
|
|
|
tr.inject(trs[i], 'before'); |
|
|
@ -316,30 +321,31 @@ var dynamicTable = new Class ({ |
|
|
|
this.context_menu.addTarget(tr); |
|
|
|
this.context_menu.addTarget(tr); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
selectAll: function() { |
|
|
|
selectAll : function () { |
|
|
|
this.cur.empty(); |
|
|
|
this.cur.empty(); |
|
|
|
this.rows.each(function(tr, id){ |
|
|
|
this.rows.each(function (tr, id) { |
|
|
|
this.cur[this.cur.length] = id; |
|
|
|
this.cur[this.cur.length] = id; |
|
|
|
if(!tr.hasClass('selected')) { |
|
|
|
if (!tr.hasClass('selected')) { |
|
|
|
tr.addClass('selected'); |
|
|
|
tr.addClass('selected'); |
|
|
|
} |
|
|
|
} |
|
|
|
}, this); |
|
|
|
}, this); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
updateRow: function(id, row, data, status){ |
|
|
|
updateRow : function (id, row, data, status) { |
|
|
|
if(!this.rows.has(id)) { |
|
|
|
if (!this.rows.has(id)) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
var tr = this.rows.get(id); |
|
|
|
var tr = this.rows.get(id); |
|
|
|
// Apply filter
|
|
|
|
// Apply filter
|
|
|
|
if(this.applyFilterOnRow(tr, status)) { |
|
|
|
if (this.applyFilterOnRow(tr, status)) { |
|
|
|
var tds = tr.getElements('td'); |
|
|
|
var tds = tr.getElements('td'); |
|
|
|
for(var i=0; i<row.length; i++) { |
|
|
|
for (var i = 0; i < row.length; i++) { |
|
|
|
if(i==1) continue; // Do not refresh name
|
|
|
|
if (i == 1) |
|
|
|
if(i==this.progressIndex) { |
|
|
|
continue; // Do not refresh name
|
|
|
|
$('pb_'+id).setValue(row[i]); |
|
|
|
if (i == this.progressIndex) { |
|
|
|
|
|
|
|
$('pb_' + id).setValue(row[i]); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if(i==0) { |
|
|
|
if (i == 0) { |
|
|
|
tds[i].getChildren('img')[0].set('src', row[i]); |
|
|
|
tds[i].getChildren('img')[0].set('src', row[i]); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
tds[i].set('html', row[i]); |
|
|
|
tds[i].set('html', row[i]); |
|
|
@ -351,7 +357,7 @@ var dynamicTable = new Class ({ |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// Row was hidden, check if it was selected
|
|
|
|
// Row was hidden, check if it was selected
|
|
|
|
// and unselect it if it was
|
|
|
|
// and unselect it if it was
|
|
|
|
if(this.cur.contains(id)) { |
|
|
|
if (this.cur.contains(id)) { |
|
|
|
// Remove from selection
|
|
|
|
// Remove from selection
|
|
|
|
this.cur.erase(id); |
|
|
|
this.cur.erase(id); |
|
|
|
// Remove selected style
|
|
|
|
// Remove selected style
|
|
|
@ -361,12 +367,11 @@ var dynamicTable = new Class ({ |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
removeRow: function(id){ |
|
|
|
removeRow : function (id) { |
|
|
|
if(this.cur.contains(id)) |
|
|
|
if (this.cur.contains(id)) { |
|
|
|
{ |
|
|
|
|
|
|
|
this.cur.erase(id); |
|
|
|
this.cur.erase(id); |
|
|
|
} |
|
|
|
} |
|
|
|
if(this.rows.has(id)) { |
|
|
|
if (this.rows.has(id)) { |
|
|
|
var tr = this.rows.get(id); |
|
|
|
var tr = this.rows.get(id); |
|
|
|
tr.dispose(); |
|
|
|
tr.dispose(); |
|
|
|
this.altRow(); |
|
|
|
this.altRow(); |
|
|
@ -376,19 +381,19 @@ var dynamicTable = new Class ({ |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
selectedIds: function(){ |
|
|
|
selectedIds : function () { |
|
|
|
return this.cur; |
|
|
|
return this.cur; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getRowId: function(tr){ |
|
|
|
getRowId : function (tr) { |
|
|
|
return this.rows.keyOf(tr); |
|
|
|
return this.rows.keyOf(tr); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getRowIds: function(){ |
|
|
|
getRowIds : function () { |
|
|
|
return this.rows.getKeys(); |
|
|
|
return this.rows.getKeys(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
//dynamicTable.implement(new Options);
|
|
|
|
//dynamicTable.implement(new Options);
|
|
|
|
//dynamicTable.implement(new Events);
|
|
|
|
//dynamicTable.implement(new Events);
|
|
|
|
|
|
|
|
|
|
|
|