matrix search fixes and performance improvements
This commit is contained in:
parent
c1155d9ab9
commit
d1680cf867
2 changed files with 28 additions and 23 deletions
|
|
@ -945,34 +945,43 @@ assetData.revisionDate
|
|||
|
||||
@results = @{ $session->db->buildArrayRefOfHashRefs($sql,[$self->getId]) };
|
||||
|
||||
my (@searchParams,@searchParams_sorted);
|
||||
if($form->process("search")){
|
||||
foreach my $param ($form->param) {
|
||||
if($param =~ m/^search_/){
|
||||
my $parameter;
|
||||
$parameter->{name} = $param;
|
||||
$parameter->{value} = $form->process($param);
|
||||
my $attributeId = $param;
|
||||
$attributeId =~ s/^search_//;
|
||||
$attributeId =~ s/_____/-/g;
|
||||
$parameter->{attributeId} = $attributeId;
|
||||
push(@searchParams,$parameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@searchParams_sorted = sort { $b->{value} <=> $a->{value} } @searchParams;
|
||||
foreach my $result (@results){
|
||||
if($form->process("search")){
|
||||
# $self->session->errorHandler->warn("checking listing: ".$result->{title});
|
||||
my $matrixListing_attributes = $session->db->buildHashRefOfHashRefs("
|
||||
select value, fieldType, attributeId from MatrixListing_attribute as listing
|
||||
left join Matrix_attribute using(attributeId)
|
||||
where listing.matrixListingId = ?
|
||||
",[$result->{assetId}],'attributeId');
|
||||
foreach my $param ($form->param) {
|
||||
if($param =~ m/^search_/){
|
||||
my $attributeId = $param;
|
||||
$attributeId =~ s/^search_//;
|
||||
$attributeId =~ s/_____/-/;
|
||||
my $fieldType = $matrixListing_attributes->{$attributeId}->{fieldType};
|
||||
my $listingValue = $matrixListing_attributes->{$attributeId}->{value};
|
||||
# $self->session->errorHandler->warn("fieldType:".$fieldType.", attributeValue: ".$form->process($param).", listingvalue: ".$listingValue);
|
||||
if(($fieldType eq 'MatrixCompare') && ($listingValue < $form->process($param))){
|
||||
where listing.matrixListingId = ? order by value asc",
|
||||
[$result->{assetId}],'attributeId');
|
||||
PARAM: foreach my $param (@searchParams_sorted) {
|
||||
my $fieldType = $matrixListing_attributes->{$param->{attributeId}}->{fieldType};
|
||||
my $listingValue = $matrixListing_attributes->{$param->{attributeId}}->{value};
|
||||
if(($fieldType eq 'MatrixCompare') && ($listingValue < $param->{value})){
|
||||
$result->{checked} = '';
|
||||
last;
|
||||
last PARAM;
|
||||
}
|
||||
elsif(($fieldType ne 'MatrixCompare') && ($form->process($param) ne $listingValue)){
|
||||
elsif(($fieldType ne 'MatrixCompare' && $fieldType ne '') && ($param->{value} ne $listingValue)){
|
||||
$result->{checked} = '';
|
||||
last;
|
||||
last PARAM;
|
||||
}
|
||||
else{
|
||||
$result->{checked} = 'checked';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
|
|
|||
|
|
@ -37,16 +37,11 @@ YAHOO.util.Event.addListener(window, "load", function() {
|
|||
var myDataTable = new YAHOO.widget.DataTable("compareForm", myColumnDefs,
|
||||
this.myDataSource, {initialRequest:uri});
|
||||
|
||||
this.myDataSource.doBeforeParseData = function (oRequest, oFullResponse) {
|
||||
myDataTable.getRecordSet().reset();
|
||||
return oFullResponse;
|
||||
}
|
||||
var myDataSource = this.myDataSource;
|
||||
|
||||
var myCallback = function() {
|
||||
myDataTable.getRecordSet().reset();
|
||||
this.set("sortedBy", null);
|
||||
this.onDataReturnAppendRows.apply(this,arguments);
|
||||
this.set("sortedBy", null);
|
||||
this.onDataReturnAppendRows.apply(this,arguments);
|
||||
compareFormButton();
|
||||
};
|
||||
|
||||
|
|
@ -66,6 +61,7 @@ YAHOO.util.Event.addListener(window, "load", function() {
|
|||
}
|
||||
myDataTable.getRecordSet().reset();
|
||||
myDataTable.refreshView();
|
||||
myDataTable.showTableMessage('Loading...');
|
||||
|
||||
myDataSource.sendRequest(newUri,callback2);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue