From c4376366f370e3e08c50f5f9b159fb4ed85a5be9 Mon Sep 17 00:00:00 2001 From: Yung Han Khoe Date: Fri, 27 Feb 2009 21:53:24 +0000 Subject: [PATCH] fixing matrix compare results --- lib/WebGUI/Asset/Wobject/Matrix.pm | 5 ++++- www/extras/wobject/Matrix/matrixCompareList.js | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/WebGUI/Asset/Wobject/Matrix.pm b/lib/WebGUI/Asset/Wobject/Matrix.pm index b9a09fc0c..a0083ef89 100644 --- a/lib/WebGUI/Asset/Wobject/Matrix.pm +++ b/lib/WebGUI/Asset/Wobject/Matrix.pm @@ -1024,6 +1024,7 @@ sub www_getCompareListData { unless (scalar(@listingIds)) { @listingIds = $self->session->form->checkList("listingId"); } + my @responseFields = ("attributeId", "name", "description","fieldType", "checked"); foreach my $listingId (@listingIds){ $listingId =~ s/_____/-/g; @@ -1038,11 +1039,13 @@ sub www_getCompareListData { url =>$listing->getUrl, lastUpdated =>$session->datetime->epochToHuman( $listing->get('revisonDate'),"%z" ), }); + push(@responseFields, $listingId_safe, $listingId_safe."_compareColor"); } push(@results,{name=>$i18n->get('last updated label'),fieldType=>'lastUpdated'}); my $jsonOutput; - $jsonOutput->{ColumnDefs} = \@columnDefs; + $jsonOutput->{ColumnDefs} = \@columnDefs; + $jsonOutput->{ResponseFields} = \@responseFields; foreach my $category (keys %{$self->getCategories}) { push(@results,{name=>$category,fieldType=>'category'}); diff --git a/www/extras/wobject/Matrix/matrixCompareList.js b/www/extras/wobject/Matrix/matrixCompareList.js index f6303a9c1..52e419ca2 100644 --- a/www/extras/wobject/Matrix/matrixCompareList.js +++ b/www/extras/wobject/Matrix/matrixCompareList.js @@ -71,8 +71,7 @@ YAHOO.util.Event.addListener(window, "load", function() { } this.myDataSource.doBeforeParseData = function (oRequest, oFullResponse) { - myDataTable.getRecordSet().reset(); - myDataTable.refreshView(); + this.responseSchema.fields = oFullResponse.ResponseFields; var existingColumns = myDataTable.getColumnSet().keys; for (var i = 0; i < existingColumns.length; i++) { if(i > 1){ @@ -114,6 +113,9 @@ YAHOO.util.Event.addListener(window, "load", function() { uri = uri+';listingId='+compareCheckBoxes[i].value; } } + myDataTable.getRecordSet().reset(); + myDataTable.refreshView(); + myDataTable.showTableMessage('Loading...'); this.myDataSource.sendRequest(uri,callback2); },this,true); @@ -126,6 +128,9 @@ YAHOO.util.Event.addListener(window, "load", function() { uri = uri+';listingId='+compareCheckBoxes[i].value; } } + myDataTable.getRecordSet().reset(); + myDataTable.refreshView(); + myDataTable.showTableMessage('Loading...'); this.myDataSource.sendRequest(uri,callback2); },this,true);