Add new method etemplate2.getById() to get etemplate object by DOM ID of container node

This commit is contained in:
Nathan Gray 2014-03-11 15:28:18 +00:00
parent 4110056a3e
commit a1ae0bdb83

View File

@ -783,6 +783,30 @@ etemplate2.getByApplication = function(app)
return list;
};
/**
* Get a etemplate2 object from the given DOM ID
*
* @param {string} id DOM ID of the container node
* @returns {etemplate2|null}
*/
etemplate2.getById = function(id)
{
for( var name in etemplate2._byTemplate)
{
console.log(name, etemplate2._byTemplate[name]);
for(var i = 0; i < etemplate2._byTemplate[name].length; i++)
{
var et = etemplate2._byTemplate[name][i];
if(et.DOMContainer.getAttribute("id") == id)
{
return et;
}
}
}
return null;
}
/**
* Plugin for egw.json type "et2_load"
*