diff --git a/build b/build index 0b05804..e6e1cd3 100755 --- a/build +++ b/build @@ -18,7 +18,11 @@ jsmin < jo.js > jo_min.js # echo "Compiling jo.js -> jo_com.js" # java -jar ~/bin/compiler.jar --js=jo.js --js_output_file=jo_com.js # gzip -c jo_com.js > jo_com.js.gz -cd .. -echo "Done." +if [[ ${1} && -d ${1} ]]; then +echo "Copying files to test directory" +cp jo.js jo_min.js ${1} +fi +cd .. +echo "Done compiling." diff --git a/js/ui/table.js b/js/ui/table.js index 999d94a..16f5425 100644 --- a/js/ui/table.js +++ b/js/ui/table.js @@ -40,20 +40,41 @@ - `getRow()`, `getCol()` Return the current row or column + + - `setOmitCols(array)` + + Sets the columns whose header is in the passed array be omited. + */ joTable = function(data) { + this.omitCols = new Array(); + this.omitIndex = new Array(); joList.apply(this, arguments); }; + joTable.extend(joList, { tagName: "jotable", + // With another round of formatItem as overhead because of refresh() + setOmitCols: function(omitArray){ + this.omitCols = omitArray; + this.refresh(); + }, + // default row formatter formatItem: function(row, index) { var tr = document.createElement("tr"); - + for (var i = 0, l = row.length; i < l; i++) { var o = document.createElement(index ? "td" : "th"); + + if ((this.omitCols.indexOf(row[i]) != -1)) { + this.omitIndex.push(i); + } + + if (this.omitIndex.indexOf(i%l) > -1) continue; + o.innerHTML = row[i]; // this is a little brittle, but plays nicely with joList's select event @@ -88,6 +109,5 @@ joTable.extend(joList, { var rowsize = this.data[0].length; return index % rowsize; - } + } }); -