Better handling for disabled columns.

Disabled grid columns don't create widgets, which caused the nm issues as it expected a widget in each cell.
This commit is contained in:
Nathan Gray 2013-08-26 16:42:49 +00:00
parent 591bb48410
commit 3b65d807ba
2 changed files with 20 additions and 0 deletions

View File

@ -579,6 +579,12 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput],
RowLoop: RowLoop:
for(var i = 0; i < _row.length; i++) for(var i = 0; i < _row.length; i++)
{ {
if(_row[i].disabled)
{
_colData[i].disabled = true;
continue;
}
// Customfields needs special processing // Customfields needs special processing
if(_row[i].widget.instanceOf(et2_nextmatch_customfields)) if(_row[i].widget.instanceOf(et2_nextmatch_customfields))
{ {
@ -692,6 +698,17 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput],
}, },
_parseHeaderRow: function(_row, _colData) { _parseHeaderRow: function(_row, _colData) {
// Make sure there's a widget - cols disabled in template can be missing them, and the header really likes to have a widget
for (var x = 0; x < _row.length; x++)
{
if(!_row[x].widget)
{
_row[x].widget = et2_createWidget("label");
}
}
// Get column display preference // Get column display preference
this._applyUserPreferences(_row, _colData); this._applyUserPreferences(_row, _colData);

View File

@ -547,6 +547,9 @@ var et2_nextmatch_rowWidget = et2_widget.extend(et2_IDOMNode,
this._widgets = new Array(_widgets.length); this._widgets = new Array(_widgets.length);
for (var i = 0; i < _widgets.length; i++) for (var i = 0; i < _widgets.length; i++)
{ {
// Disabled columns might be missing widget - skip it
if(!_widgets[i]) continue;
this._widgets[i] = _widgets[i].clone(this); this._widgets[i] = _widgets[i].clone(this);
this._widgets[i].loadingFinished(); this._widgets[i].loadingFinished();
// Set column alignment from widget // Set column alignment from widget