Instead of re-rendering CRM infolog list, just use javascript to update the filter.

Faster, and avoids destroying the addressbook etemplate2 object by loading the infolog into it.
This commit is contained in:
Nathan Gray 2014-03-12 15:21:01 +00:00
parent 08424b0307
commit 56169beb2e
2 changed files with 28 additions and 0 deletions

View File

@ -2162,6 +2162,15 @@ window.egw_LAB.wait(function() {
));
}
$content['index'] = $query['start'];
// Infolog nextmatch is already there, just update the filter
if($contact_id && egw_json_request::isJSONRequest())
{
egw_json_response::get()->apply('app.addressbook.view_set_infolog',Array($contact_id));
// Clear contact_id, it's used as a flag to send infolog
unset($contact_id);
}
break;
}
}

View File

@ -92,6 +92,25 @@ app.classes.addressbook = AppJS.extend(
this.egw.open(id, 'addressbook', 'view', {index: index}, '_self', 'addressbook');
},
/**
* Set link filter for the already open & rendered infolog list
*
* @param {string} contact_id New contact ID
*/
view_set_infolog: function(contact_id)
{
// Find the infolog list
var infolog = etemplate2.getById(
$j(this.et2.getInstanceManager().DOMContainer).next('.et2_container').attr('id')
);
var nm = null;
if(infolog != null && (nm = infolog.widgetContainer.getWidgetById('nm')))
{
// Update the link filter to new contact
nm.applyFilters({col_filter: {linked: 'addressbook:'+contact_id}});
}
},
/**
* Run an action from CRM view toolbar
*