From a32b42fe1979824fdf204c19eaaef149d6649bb6 Mon Sep 17 00:00:00 2001 From: Normann Lou Date: Fri, 10 Oct 2008 03:21:30 +0000 Subject: [PATCH] BUGFIX: fix the bug that add some rules for summary columns even when they are not there. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64049 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- javascript/TableListField.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/javascript/TableListField.js b/javascript/TableListField.js index 4be78a361..47ecf541b 100755 --- a/javascript/TableListField.js +++ b/javascript/TableListField.js @@ -41,7 +41,10 @@ TableListField.prototype = { // TODO Breaks with nested divs var summaryCols = $$('tfoot tr.summary td', this); this._summaryDefs = []; - if(summaryCols) { + + //if(summaryCols) { + //should check summaryCols.length, cos summaryCols will be alway an array, though its length could be 0. + if(summaryCols.length) { rules['#'+this.id+' table.data tbody input'] = { onchange: function(e) { if (!e) e = window.event; // stupid IE @@ -63,7 +66,10 @@ TableListField.prototype = { } Behaviour.register('TableListField_'+this.id,rules); - if(summaryCols) { + + //if(summaryCols) { + //should check summaryCols.length, cos summaryCols will be alway an array, though its length could be 0. + if(summaryCols.length) { //this._getSummaryDefs(summaryCols); } },