Commit ee652576 authored by alekseys's avatar alekseys Committed by Commit bot

Take search query into account rendering recent destination list items.

BUG=363590

Review URL: https://codereview.chromium.org/595423002

Cr-Commit-Position: refs/heads/master@{#296502}
parent fb940cbf
...@@ -231,12 +231,19 @@ cr.define('print_preview', function() { ...@@ -231,12 +231,19 @@ cr.define('print_preview', function() {
loadTimeData.getStringF('destinationCount', destinations.length); loadTimeData.getStringF('destinationCount', destinations.length);
setIsVisible(this.getChildElement('.destination-list > footer'), true); setIsVisible(this.getChildElement('.destination-list > footer'), true);
} }
for (var i = 0; i < numItems; i++) { for (var i = 0; i < numItems; i++)
var destListItem = new print_preview.DestinationListItem( this.renderListItemInternal(destinations[i]);
this.eventTarget_, destinations[i], this.query_); },
this.addChild(destListItem);
destListItem.render(this.getChildElement('.destination-list > ul')); /**
} * @param {!print_preview.Destination} destination Destination to render.
* @protected
*/
renderListItemInternal: function(destination) {
var listItem = new print_preview.DestinationListItem(
this.eventTarget_, destination, this.query_);
this.addChild(listItem);
listItem.render(this.getChildElement('.destination-list > ul'));
}, },
/** /**
......
...@@ -35,12 +35,8 @@ cr.define('print_preview', function() { ...@@ -35,12 +35,8 @@ cr.define('print_preview', function() {
destinations.length == 0); destinations.length == 0);
setIsVisible(this.getChildElement('.destination-list > footer'), false); setIsVisible(this.getChildElement('.destination-list > footer'), false);
var numItems = Math.min(destinations.length, this.shortListSize_); var numItems = Math.min(destinations.length, this.shortListSize_);
for (var i = 0; i < numItems; i++) { for (var i = 0; i < numItems; i++)
var destListItem = new print_preview.DestinationListItem( this.renderListItemInternal(destinations[i]);
this.eventTarget_, destinations[i]);
this.addChild(destListItem);
destListItem.render(this.getChildElement('.destination-list > ul'));
}
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment