Replace missing changes

This commit is contained in:
nathangray 2020-01-23 05:02:08 -07:00
parent 31104b4bee
commit f1ddc7c30a
4 changed files with 35 additions and 17 deletions

View File

@ -493,10 +493,13 @@ var et2_dataview = (function(){ "use strict"; return Class.extend({
*/ */
_buildGrid: function() { _buildGrid: function() {
// Create the collection of column ids // Create the collection of column ids
var colIds = new Array(this.columns.length); var colIds = [];
for (var i = 0; i < this.columns.length; i++) for (var i = 0; i < this.columns.length; i++)
{ {
colIds[i] = this.columns[i].id; if(this.columns[i].visible)
{
colIds[i] = this.columns[i].id;
}
} }
// Create the row provider // Create the row provider

View File

@ -99,14 +99,15 @@ var et2_dataview_rowProvider = (function(){ "use strict"; return Class.extend(
_createDefaultPrototype: function() { _createDefaultPrototype: function() {
var tr = jQuery(document.createElement("tr")); var tr = jQuery(document.createElement("tr"));
// Append a td for each column // Append a td for each visible column
for (var i = 0; i < this._columnIds.length; i++) for(var column of this._columnIds)
{ {
if(!column) continue;
var td = jQuery(document.createElement("td")) var td = jQuery(document.createElement("td"))
.addClass(this._outerId + "_td_" + this._columnIds[i]) .addClass(this._outerId + "_td_" + column)
.appendTo(tr); .appendTo(tr);
var div = jQuery(document.createElement("div")) var div = jQuery(document.createElement("div"))
.addClass(this._outerId + "_div_" + this._columnIds[i]) .addClass(this._outerId + "_div_" + column)
.addClass("innerContainer") .addClass("innerContainer")
.appendTo(td); .appendTo(td);
} }

View File

@ -1151,7 +1151,7 @@ var et2_nextmatch = (function(){ "use strict"; return et2_DOMWidget.extend([et2_
if(colName == 'actions' || colName == 'legacy_actions' || colName == 'legacy_actions_check_all') if(colName == 'actions' || colName == 'legacy_actions' || colName == 'legacy_actions_check_all')
{ {
remove_action_index = x; remove_action_index = x;
continue;
} }
else if (!colName) else if (!colName)
{ {
@ -1213,14 +1213,18 @@ var et2_nextmatch = (function(){ "use strict"; return et2_DOMWidget.extend([et2_
}, },
_parseDataRow: function(_row, _rowData, _colData) { _parseDataRow: function(_row, _rowData, _colData) {
var columnWidgets = new Array(this.columns.length); var columnWidgets = [];
_row.sort(function(a,b) { _row.sort(function(a,b) {
return a.colData.order - b.colData.order; return a.colData.order - b.colData.order;
}); });
for (var x = 0; x < columnWidgets.length; x++) for (var x = 0; x < this.columns.length; x++)
{ {
if (!this.columns[x].visible)
{
continue;
}
if (typeof _row[x] != "undefined" && _row[x].widget) if (typeof _row[x] != "undefined" && _row[x].widget)
{ {
columnWidgets[x] = _row[x].widget; columnWidgets[x] = _row[x].widget;
@ -1525,7 +1529,7 @@ var et2_nextmatch = (function(){ "use strict"; return et2_DOMWidget.extend([et2_
var value = select.getValue(); var value = select.getValue();
if (data_id.match(/^col_/) && value.indexOf(data_id) != -1) if (data_id.match(/^col_/) && value.indexOf(data_id) != -1)
{ {
var col_id = data_id.replace('col_','') var col_id = data_id.replace('col_','');
var col_widget = self.columns[col_id].widget; var col_widget = self.columns[col_id].widget;
if (col_widget.customfields) if (col_widget.customfields)
{ {
@ -2389,7 +2393,7 @@ var et2_nextmatch = (function(){ "use strict"; return et2_DOMWidget.extend([et2_
},ctx); },ctx);
count += 200; count += 200;
} while (count < rows) } while (count < rows);
nm.controller._grid.setScrollHeight(nm.controller._grid.getAverageHeight() * (rows+1)); nm.controller._grid.setScrollHeight(nm.controller._grid.getAverageHeight() * (rows+1));
} }
else else

View File

@ -236,7 +236,7 @@ var et2_nextmatch_rowProvider = (function(){ "use strict"; return ClassWithAttri
_getVariableAttributeSet: function(_widget) { _getVariableAttributeSet: function(_widget) {
var variableAttributes = []; var variableAttributes = [];
_widget.iterateOver(function(_widget) { var process = function(_widget) {
// Create the attribtues // Create the attribtues
var hasAttr = false; var hasAttr = false;
var widgetData = { var widgetData = {
@ -270,13 +270,17 @@ var et2_nextmatch_rowProvider = (function(){ "use strict"; return ClassWithAttri
variableAttributes.push(widgetData); variableAttributes.push(widgetData);
} }
}); };
// Check each column // Check each column
var columns = _widget.getChildren(); var columns = _widget.getChildren();
for(var i = 0; i < columns.length; i++) for(var i = 0; i < columns.length; i++)
{ {
// If column is hidden, don't process it
if(this._context && this._context.columns && this._context.columns[i] && !this._context.columns[i].visible)
{
continue;
}
columns[i].iterateOver(process, this); columns[i].iterateOver(process, this);
} }
@ -578,7 +582,8 @@ var et2_nextmatch_rowWidget = (function(){ "use strict"; return et2_widget.exten
*/ */
createWidgets: function(_widgets) { createWidgets: function(_widgets) {
// Clone the given the widgets with this element as parent // Clone the given the widgets with this element as parent
this._widgets = new Array(_widgets.length); this._widgets = [];
var row_id = 0;
for (var i = 0; i < _widgets.length; i++) for (var i = 0; i < _widgets.length; i++)
{ {
// Disabled columns might be missing widget - skip it // Disabled columns might be missing widget - skip it
@ -589,8 +594,9 @@ var et2_nextmatch_rowWidget = (function(){ "use strict"; return et2_widget.exten
// Set column alignment from widget // Set column alignment from widget
if(this._widgets[i].align) if(this._widgets[i].align)
{ {
this._row.childNodes[i].align = this._widgets[i].align; this._row.childNodes[row_id].align = this._widgets[i].align;
} }
row_id++;
} }
}, },
@ -601,12 +607,16 @@ var et2_nextmatch_rowWidget = (function(){ "use strict"; return et2_widget.exten
* @return {DOMElement} * @return {DOMElement}
*/ */
getDOMNode: function(_sender) { getDOMNode: function(_sender) {
var row_id = 0;
for (var i = 0; i < this._widgets.length; i++) for (var i = 0; i < this._widgets.length; i++)
{ {
// Disabled columns might be missing widget - skip it
if(!this._widgets[i]) continue;
if (this._widgets[i] == _sender) if (this._widgets[i] == _sender)
{ {
return this._row.childNodes[i].childNodes[0]; // Return the i-th td tag return this._row.childNodes[row_id].childNodes[0]; // Return the i-th td tag
} }
row_id++;
} }
return null; return null;