Support row ids from template:

id="$row_cont[field]"
This commit is contained in:
Nathan Gray 2013-07-16 16:22:20 +00:00
parent d63ee993b3
commit 85db39ed4e

View File

@ -196,6 +196,12 @@ var et2_grid = et2_DOMWidget.extend([et2_IDetachedDOM, et2_IAligned],
rowDataEntry["class"] = et2_readAttrWithDefault(node, "class", ""); rowDataEntry["class"] = et2_readAttrWithDefault(node, "class", "");
rowDataEntry["valign"] = et2_readAttrWithDefault(node, "valign", ""); rowDataEntry["valign"] = et2_readAttrWithDefault(node, "valign", "");
rowDataEntry["span"] = et2_readAttrWithDefault(node, "span", "1"); rowDataEntry["span"] = et2_readAttrWithDefault(node, "span", "1");
var id = et2_readAttrWithDefault(node, "id", "");
if(id)
{
rowDataEntry["id"] = id;
}
} }
else else
{ {
@ -216,7 +222,7 @@ var et2_grid = et2_DOMWidget.extend([et2_IDetachedDOM, et2_IAligned],
{ {
if(content.data[rowIndex]) if(content.data[rowIndex])
{ {
rowData[rowIndex] = rowDataEntry; rowData[rowIndex] = jQuery.extend({}, rowDataEntry);
rowIndex++; rowIndex++;
} }
@ -385,6 +391,10 @@ var et2_grid = et2_DOMWidget.extend([et2_IDetachedDOM, et2_IAligned],
//this.getArrayMgr(name).perspectiveData.row = y; //this.getArrayMgr(name).perspectiveData.row = y;
} }
if(this._getCell(cells, x,y).rowData.id)
{
this.getArrayMgr("content").expandName(this.rowData[y].id);
}
// If row disabled, just skip it // If row disabled, just skip it
var disabled = false; var disabled = false;
if(node.getAttribute("disabled") == "1") if(node.getAttribute("disabled") == "1")
@ -416,6 +426,10 @@ var et2_grid = et2_DOMWidget.extend([et2_IDetachedDOM, et2_IAligned],
this.getArrayMgr(name).perspectiveData.row = y; this.getArrayMgr(name).perspectiveData.row = y;
} }
} }
if(this._getCell(cells, x, y).rowData.id)
{
this._getCell(cells, x, y).rowData.id = this.getArrayMgr("content").expandName(this._getCell(cells, x, y).rowData.id);
}
et2_filteredNodeIterator(this.lastRowNode, readRowNode, this); et2_filteredNodeIterator(this.lastRowNode, readRowNode, this);
} }
@ -538,6 +552,11 @@ var et2_grid = et2_DOMWidget.extend([et2_IDetachedDOM, et2_IAligned],
{ {
tr.attr("valign", this.rowData[y].valign); tr.attr("valign", this.rowData[y].valign);
} }
if(this.rowData[y].id)
{
tr.attr("id", this.rowData[y].id);
}
// Create the cells. x is incremented by the colSpan value of the // Create the cells. x is incremented by the colSpan value of the
// cell. // cell.
for (var x = 0; x < w;) for (var x = 0; x < w;)