From 9d14e8b42062ac03238f2177e2d21bcf41445b5c Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 9 Nov 2009 16:49:10 -0800 Subject: [PATCH] Fix rendering of initial DataTable in IE7, IE8. Fixes bug #11205. Added TR, TD tags to table containing the DataTable. Also, ran dataTable.js through jslint and fixed many issues. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Asset/Wobject/DataTable.pm | 6 ++++-- www/extras/yui-webgui/build/form/datatable.js | 14 +++++++------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index ea16ec167..616eb1533 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -6,6 +6,7 @@ - fixed #11209: Form::HTMLArea uses invalid javascript identifier - fixed #11186: Template Attachments i18n - fixed #11218: LDAPS does not create users automatically + - fixed #11205: DataTable borked in IE 7.8.4 - Fixed a compatibility problem between WRE and new Spectre code. diff --git a/lib/WebGUI/Asset/Wobject/DataTable.pm b/lib/WebGUI/Asset/Wobject/DataTable.pm index 3d6b964f6..6dd346a37 100644 --- a/lib/WebGUI/Asset/Wobject/DataTable.pm +++ b/lib/WebGUI/Asset/Wobject/DataTable.pm @@ -125,7 +125,7 @@ sub getDataTemplateVars { my $self = shift; my $json = $self->getDataJson; - my $dt = JSON->new->decode($json); + my $dt = eval { JSON->new->decode($json) }; # Make row data more friendly to templates my %cols = map { $_->{key} => $_ } @{ $dt->{columns} }; @@ -154,7 +154,8 @@ sub getEditForm { my $tabform = $self->SUPER::getEditForm(@_); $tabform->getTab("data")->raw( - WebGUI::Form::DataTable->new( + q{} + . WebGUI::Form::DataTable->new( $self->session, { name => "data", value => $self->get("data"), @@ -162,6 +163,7 @@ sub getEditForm { showEdit => 1, } )->toHtml + . q{} ); return $tabform; diff --git a/www/extras/yui-webgui/build/form/datatable.js b/www/extras/yui-webgui/build/form/datatable.js index 96319828e..39d6882ea 100644 --- a/www/extras/yui-webgui/build/form/datatable.js +++ b/www/extras/yui-webgui/build/form/datatable.js @@ -135,7 +135,7 @@ WebGUI.Form.DataTable /* If we set the focus now, something might (and sometimes does) set * it later in the event handling chain. Let's defer the focus set * until this chain is finished. */ - setTimeout(function() { obj.editor.focus() }, 0); + setTimeout(function() { obj.editor.focus(); }, 0); }; /************************************************************************ @@ -475,7 +475,7 @@ WebGUI.Form.DataTable // Find the last indexed column var newIdx = cols.length; // create a new column object - cols[newIdx] = new YAHOO.widget.Column; + cols[newIdx] = new YAHOO.widget.Column(); // add it to the dialog box this.appendChild( createTableColumn(newIdx,cols) ); }; @@ -526,13 +526,13 @@ WebGUI.Form.DataTable fixedcenter : true } ); dialog.setBody( this.i18n.get( "Form_DataTable", "save success" ) + "
" ); - new YAHOO.widget.Button( { + var button = new YAHOO.widget.Button( { id : "ok", type : "push", label : this.i18n.get( "Form_DataTable", "ok" ), container : dialog.body, onclick : { - fn : function () { this.destroy() }, + fn : function () { this.destroy(); }, scope : dialog } } ); @@ -544,13 +544,13 @@ WebGUI.Form.DataTable fixedcenter : true } ); dialog.setBody( this.i18n.get( "Form_DataTable", "save failure" ) + "
" ); - new YAHOO.widget.Button( { + var button = new YAHOO.widget.Button( { id : "ok", type : "push", label : this.i18n.get( "Form_DataTable", "ok" ), container : dialog.body, onclick : { - fn : function () { this.destroy() }, + fn : function () { this.destroy(); }, scope : dialog } } ); @@ -656,6 +656,6 @@ WebGUI.Form.DataTable this.dataTable.render(); this.schemaDialog.cancel(); - } + }; };