From 2b3686540f89c16d4184a058d8bc1e44ee28b616 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Tue, 29 May 2012 17:22:18 +0000 Subject: [PATCH] Fix action column removal to handle action columns that are not the last column --- etemplate/js/et2_extension_nextmatch.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/etemplate/js/et2_extension_nextmatch.js b/etemplate/js/et2_extension_nextmatch.js index 86b9e43dbd..9ae8e21307 100644 --- a/etemplate/js/et2_extension_nextmatch.js +++ b/etemplate/js/et2_extension_nextmatch.js @@ -480,6 +480,10 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput], { // Go over the header row and create the column entries this.columns = new Array(_row.length); var columnData = new Array(_row.length); + + // No action columns in et2 + var remove_action_index = null; + for (var x = 0; x < _row.length; x++) { this.columns[x] = { @@ -490,18 +494,16 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput], { columnData[x] = { "id": "col_" + x, "caption": this._genColumnCaption(_row[x].widget), - "visibility": _colData[x].disabled ? + "visibility": (!_colData[x] || _colData[x].disabled) ? ET2_COL_VISIBILITY_INVISIBLE : ET2_COL_VISIBILITY_VISIBLE, - "width": _colData[x].width + "width": _colData[x] ? _colData[x].width : 0 }; // No action columns in et2 var colName = this._getColumnName(_row[x].widget); if(colName == 'actions' || colName == 'legacy_actions' || colName == 'legacy_actions_check_all') { - this.columns.splice(x,x); - columnData.splice(x,x); - _colData.splice(x,x); + remove_action_index = x; continue; } @@ -509,6 +511,14 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput], { this.addChild(_row[x].widget); } + // Remove action column + if(remove_action_index != null) + { + this.columns.splice(x,x); + columnData.splice(x,x); + _colData.splice(x,x); + } + // Create the column manager and update the grid container this.dataview.setColumns(columnData);