Fix actions over grid always return the last row DOMNode, by passing DOMNode to et2_action_object_impl constructor for cases like the infamous loop problem (JS closure)

This commit is contained in:
Hadi Nategh 2014-02-18 13:59:45 +00:00
parent e789a8f3ee
commit d500e4cc91
2 changed files with 9 additions and 5 deletions

View File

@ -704,12 +704,16 @@ var et2_surroundingsMgr = Class.extend(
* The class extension is different than the widgets
*
* @param {et2_DOMWidget} widget
* @param {Object} node
*
*/
function et2_action_object_impl(widget)
function et2_action_object_impl(widget, node)
{
var aoi = new egwActionObjectInterface();
var objectNode = node;
aoi.doGetDOMNode = function() {
return widget.getDOMNode();
return objectNode?objectNode:widget.getDOMNode();
};
// _outerCall may be used to determine, whether the state change has been
@ -732,7 +736,7 @@ function et2_action_object_impl(widget)
break;
}
};
return aoi;
};

View File

@ -881,9 +881,9 @@ var et2_grid = et2_DOMWidget.extend([et2_IDetachedDOM, et2_IAligned],
for(var i = 0; i < this.rowData.length; i++)
{
// Add a new action object to the object manager
var aoi = new et2_action_object_impl(this);
var row = $j('tr', this.tbody)[i];
aoi.doGetDOMNode = function() { return row;};
var aoi = new et2_action_object_impl(this, row);
var obj = widget_object.addObject("row_"+i, aoi);
obj.updateActionLinks(action_links);
}