- Make sure we always use index's nextmatch

- Add some documentation about the this.et2 variable
This commit is contained in:
Nathan Gray 2015-12-02 18:42:55 +00:00
parent 5343a4eae3
commit e56ff68a61
2 changed files with 33 additions and 4 deletions

View File

@ -153,9 +153,10 @@ app.classes.infolog = AppJS.extend(
// call parent
var state = this._super.apply(this, arguments);
var nm = {};
// Prevents to get access to freed et2 object
// TODO: needs more investigation to see why this.et2 sometimes gets free
if(this.et2 && Object.keys(this.et2).length >1)
// Get index etemplate
var et2 = etemplate2.getById('infolog-index');
if(et2)
{
var content = this.et2.getArrayMgr('content');
nm = content? content.data.nm: {};

View File

@ -73,7 +73,35 @@ var AppJS = Class.extend(
appname: '',
/**
* Internal reference to etemplate2 widget tree
* Internal reference to the most recently loaded etemplate2 widget tree
*
* NOTE: This variable can change which etemplate it points to as the user
* works. For example, loading the home or admin apps can cause
* et2_ready() to be called again with a different template. this.et2 will
* then point to a different template. If the user then closes that tab,
* this.et2 will point to a destroyed object, and trying to use it will fail.
*
* If you need a reference to a certain template you can either store a local
* reference or access it through etemplate2.
*
* @example <caption>Store a local reference</caption>
* // in et2_ready()
* if(name == 'index') this.index_et2 = et2.widgetContainer;
*
* // Remember to clean up in destroy()
* delete this.index_et2;
*
* // Instead of this.et2, using a local reference
* this.index_et2 ...
*
*
* @example <caption>Access via etemplate2 object</caption>
* // Instead of this.et2, using it's unique ID
* var et2 = etemplate2.getById('myapp-index)
* if(et2)
* {
* et2.widgetContainer. ...
* }
*
* @var {et2_container}
*/