diff --git a/www/extras/yui-webgui/build/form/datatable.js b/www/extras/yui-webgui/build/form/datatable.js index d9f89b854..6d753f9ef 100644 --- a/www/extras/yui-webgui/build/form/datatable.js +++ b/www/extras/yui-webgui/build/form/datatable.js @@ -1,4 +1,5 @@ +/*global WebGUI*/ // Initialize namespace if (typeof WebGUI == "undefined") { var WebGUI = {}; @@ -49,7 +50,7 @@ WebGUI.Form.DataTable data = {}; var columns = this.dataTable.getColumnSet().getDefinitions(); for ( var i = 0; i < columns.length; i++ ) { - data[ columns[ i ].key ] = columns[i].formatter == "date" ? new Date : ""; + data[ columns[ i ].key ] = columns[i].formatter == "date" ? new Date() : ""; } } this.dataTable.addRow( data ); @@ -85,7 +86,7 @@ WebGUI.Form.DataTable // Get the columns var cols = this.dataTable.getColumnSet().getDefinitions(); - for ( var i = 0; i < cols.length; i++ ) { + for ( i = 0; i < cols.length; i++ ) { data.columns[ i ] = cols[i]; delete data.columns[ i ].editor; delete data.columns[ i ].editorOptions; @@ -459,10 +460,12 @@ WebGUI.Form.DataTable format.name = "format_" + i; for ( var x = 0; x < availableFormats.length; x++ ) { + var selected = cols[i].formatter == availableFormats[x].value; var opt = new Option( availableFormats[x].label, availableFormats[x].value, - cols[i].formatter == availableFormats[x].value + selected, + selected ); format.appendChild( opt ); } @@ -606,7 +609,7 @@ WebGUI.Form.DataTable var oldKey = data[ "oldKey_" + i ]; var newKey = data[ "newKey_" + i ]; var format = data[ "format_" + i ][0]; - var col = this.dataTable.getColumn( oldKey ); + col = this.dataTable.getColumn( oldKey ); // Don't allow adding multiple columns with same key if ( oldKey != newKey && this.dataTable.getColumn( newKey ) ) { @@ -618,9 +621,9 @@ WebGUI.Form.DataTable // If the key has changed, update the row data if ( col && col.key != newKey ) { var rows = this.dataTable.getRecordSet().getRecords(); - for ( var i = 0; i < rows.length; i++ ) { - rows[ i ].setData( newKey, rows[ i ].getData( oldKey ) ); - rows[ i ].setData( oldKey, undefined ); + for ( var r = 0; r < rows.length; r++ ) { + rows[ r ].setData( newKey, rows[ r ].getData( oldKey ) ); + rows[ r ].setData( oldKey, undefined ); } } @@ -655,7 +658,7 @@ WebGUI.Form.DataTable var numRecords = allRecords.length; for (j=0; j < numRecords; j++) { if (format == "date") { - allRecords[j].setData(newKey, new Date); + allRecords[j].setData(newKey, new Date()); } else { allRecords[j].setData(newKey, ''); }