Fixed problem changing page in association facet.

The association facet has been modified to detect page change to
determine whether the facet needs to be updated.

Ticket #1459
This commit is contained in:
Endi S. Dewata 2011-11-03 23:43:58 -05:00 committed by Petr Vobornik
parent 2eb6414372
commit 6802ea7d70
2 changed files with 12 additions and 4 deletions

View File

@ -1165,7 +1165,7 @@ IPA.association_facet = function (spec) {
that.table.total_pages = 1;
}
that.table.current_page = 1;
delete that.table.current_page;
that.table.refresh();
that.table.unselect_all();
@ -1207,8 +1207,14 @@ IPA.association_facet = function (spec) {
that.needs_update = function() {
if (that._needs_update !== undefined) return that._needs_update;
var pkey = IPA.nav.get_state(that.entity.name+'-pkey');
return that.pkey !== pkey;
if (that.pkey !== pkey) return true;
var page = parseInt(IPA.nav.get_state(that.entity_name+'-page'), 10) || 1;
if (that.table.current_page !== page) return true;
return false;
};
/*initialization*/

View File

@ -156,8 +156,10 @@ IPA.entity = function(spec) {
var facet_name = IPA.nav.get_state(that.name+'-facet');
that.facet = that.get_facet(facet_name);
var needs_update = that.facet.needs_update();
// same entity, same facet, and doesn't need updating => return
if (that == prev_entity && that.facet == prev_facet && !that.facet.needs_update()) {
if (that == prev_entity && that.facet == prev_facet && !needs_update) {
return;
}
@ -175,7 +177,7 @@ IPA.entity = function(spec) {
that.facet.create(facet_container);
}
if (that.facet.needs_update()) {
if (needs_update) {
that.facet.clear();
that.facet.show();
that.facet.header.select_tab();