Author: nathangray
New Revision: 55335
URL: http://svn.stylite.de/viewvc/egroupware?rev=55335&view=rev
Log:
Re-commit of 55312, this time with improved support for columns with no label / ID (can not be toggled or resized)
Allow gridview / nextmatch columns to be disabled and not show as options in the column list by sending something from the server. Previously was only parsed & disabled on first load.
eg: setting the column disabled=@no_column, then setting no_column=true in the get_rows response to disable it.
Note: to re-enable the column ,you must send no_column=false
Modified:
trunk/etemplate/js/et2_dataview.js
trunk/etemplate/js/et2_dataview_model_columns.js
trunk/etemplate/js/et2_extension_nextmatch.js
trunk/etemplate/js/et2_extension_nextmatch_controller.js
trunk/etemplate/js/et2_widget_grid.js
trunk/etemplate/templates/default/etemplate2.css
trunk/pixelegg/css/mobile.css
trunk/pixelegg/mobile/fw_mobile.css
— trunk/etemplate/js/et2_dataview.js (original)
+++ trunk/etemplate/js/et2_dataview.js Wed Mar 9 18:29:29 2016
@@ -406,43 +406,50 @@
if(this.columnMgr && this.columnMgr.columns[i])
{
column.addClass(this.columnMgr.columns[i].fixedWidth ? ‘fixedWidth’ : ‘relativeWidth’);
-
if(this.columnMgr.columns[i].visibility === ET2_COL_VISIBILITY_ALWAYS_NOSELECT)
-
{
-
column.addClass('noResize');
-
}
}
// make column resizable
var enc_column = self.columnMgr.getColumnById(col.id);
-
et2_dataview_makeResizeable(column, function(_w) {
-
-
// User wants the column to stay where they put it, even for relative
-
// width columns, so set it explicitly first and adjust other relative
-
// columns to match.
-
if(this.relativeWidth)
-
{
-
// Set to selected width
-
this.set_width(_w + "px");
-
self.columnMgr.updated = true;
-
// Just triggers recalculation
-
self.columnMgr.getColumnWidth(0);
-
-
// Set relative widths to match
-
var relative = self.columnMgr.totalWidth - self.columnMgr.totalFixed + _w;
-
this.set_width(_w / relative);
-
for(var i = 0; i < self.columnMgr.columns.length; i++)
-
if(enc_column.visibility !== ET2_COL_VISIBILITY_ALWAYS_NOSELECT)
-
{
-
et2_dataview_makeResizeable(column, function(_w) {
-
-
// User wants the column to stay where they put it, even for relative
-
// width columns, so set it explicitly first and adjust other relative
-
// columns to match.
-
if(this.relativeWidth)
{
-
var col = self.columnMgr.columns[i];
-
if(col == this || col.fixedWidth) continue;
-
col.set_width(self.columnMgr.columnWidths[i] / relative);
-
// Set to selected width
-
this.set_width(_w + "px");
-
self.columnMgr.updated = true;
-
// Just triggers recalculation
-
self.columnMgr.getColumnWidth(0);
-
-
// Set relative widths to match
-
var relative = self.columnMgr.totalWidth - self.columnMgr.totalFixed + _w;
-
this.set_width(_w / relative);
-
for(var i = 0; i < self.columnMgr.columns.length; i++)
-
{
-
var col = self.columnMgr.columns[i];
-
if(col == this || col.fixedWidth) continue;
-
col.set_width(self.columnMgr.columnWidths[i] / relative);
-
}
-
// Triggers column change callback, which saves
-
self.updateColumns();
}
-
// Triggers column change callback, which saves
-
self.updateColumns();
-
}
-
else
-
{
-
this.set_width(this.relativeWidth ? (_w / self.columnMgr.totalWidth) : _w + "px");
-
self.columnMgr.updated = true;
-
self.updateColumns();
-
}
-
-
}, enc_column);
-
else
-
{
-
this.set_width(this.relativeWidth ? (_w / self.columnMgr.totalWidth) : _w + "px");
-
self.columnMgr.updated = true;
-
self.updateColumns();
-
}
-
-
}, enc_column);
-
}
// Store both nodes in the columnNodes array
this.columnNodes.push({
— trunk/etemplate/js/et2_dataview_model_columns.js (original)
+++ trunk/etemplate/js/et2_dataview_model_columns.js Wed Mar 9 18:29:29 2016
@@ -21,6 +21,7 @@
var ET2_COL_VISIBILITY_VISIBLE = 1;
var ET2_COL_VISIBILITY_INVISIBLE = 2;
var ET2_COL_VISIBILITY_ALWAYS_NOSELECT = 3;
+var ET2_COL_VISIBILITY_DISABLED = 4;
/**
- Class which stores the data of a single column.
@@ -251,7 +252,9 @@
result.push({
“id”: this.columns[i].id,
“width”: this.getColumnWidth(i),
@@ -272,6 +275,7 @@
result[this.columns[i].id] = {
“caption”: this.columns[i].caption,
“enabled”: (this.columns[i].visibility != ET2_COL_VISIBILITY_ALWAYS) &&
@@ -327,7 +331,9 @@
for (var i = 0; i < this.columns.length; i++)
{
var col = this.columns[i];
-
if (col.visibility !== ET2_COL_VISIBILITY_INVISIBLE &&
-
col.visibility !== ET2_COL_VISIBILITY_DISABLED
-
)
{
// Some bounds sanity checking
if(col.fixedWidth > tw || col.fixedWidth < 0)
@@ -356,7 +362,9 @@
{
var w = 0;
var col = this.columns[i];
@@ -395,7 +403,8 @@
// Pick the first relative column and use it
for(columnIndex = 0; columnIndex < this.columns.length; columnIndex++)
{
— trunk/etemplate/js/et2_extension_nextmatch.js (original)
+++ trunk/etemplate/js/et2_extension_nextmatch.js Wed Mar 9 18:29:29 2016
@@ -850,9 +850,9 @@
for(var i = 0; i < _row.length; i++)
{
colName = ‘’;
@@ -873,14 +873,14 @@
}
// Resets field visibility too
_row[i].widget._getColumnName();
@@ -907,12 +907,12 @@
{
if(columnDisplay[j] == colName)
{
@@ -1047,12 +1047,18 @@
“widget”: _row[x].widget
},_colData[x]);
-
var visibility = (!_colData[x] || _colData[x].visible) ?
-
ET2_COL_VISIBILITY_VISIBLE :
-
ET2_COL_VISIBILITY_INVISIBLE;
-
if(_colData[x].disabled && _colData[x].disabled !=='' &&
-
this.getArrayMgr("content").parseBoolExpression(_colData[x].disabled))
-
{
-
visibility = ET2_COL_VISIBILITY_DISABLED;
-
}
columnData[x] = {
"id": "col_" + x,
"caption": this._genColumnCaption(_row[x].widget),
-
"visibility": (!_colData[x] || _colData[x].disabled) ?
-
ET2_COL_VISIBILITY_INVISIBLE : ET2_COL_VISIBILITY_VISIBLE,
@@ -1070,6 +1076,11 @@
{
remove_action_index = x;
continue;
@@ -1142,7 +1153,7 @@
columnWidgets[x] = _row[x].widget;
}
// Pass along column alignment
@@ -1295,8 +1306,9 @@
{
var col = columnMgr.columns[i];
var widget = this.columns[i].widget;
-
-
if(col.caption && col.visibility !== ET2_COL_VISIBILITY_ALWAYS_NOSELECT &&
-
col.visibility !== ET2_COL_VISIBILITY_DISABLED)
{
columns[col.id] = col.caption;
if(col.visibility == ET2_COL_VISIBILITY_VISIBLE) columns_selected.push(col.id);
@@ -1369,7 +1381,8 @@
for (var i = 0; i < columnMgr.columns.length; i++)
{
var col = columnMgr.columns[i];
— trunk/etemplate/js/et2_extension_nextmatch_controller.js (original)
+++ trunk/etemplate/js/et2_extension_nextmatch_controller.js Wed Mar 9 18:29:29 2016
@@ -581,6 +581,27 @@
}
}
}
-
// Might be trying to disable a column
-
var col_refresh = false;
-
for(var column_index = 0; column_index < nm.columns.length; column_index++)
-
{
-
if(typeof nm.columns[column_index].disabled === 'string' &&
-
nm.columns[column_index].disabled[0] === '@')
-
{
-
col_refresh = true;
-
nm.dataview.columnMgr.getColumnById('col_'+column_index)
-
.set_visibility(
-
nm.getArrayMgr('content').parseBoolExpression(nm.columns[column_index].disabled) ?
-
ET2_COL_VISIBILITY_DISABLED :
-
ET2_COL_VISIBILITY_VISIBLE
-
);
-
}
-
}
-
if(col_refresh)
-
{
-
nm.dataview.columnMgr.updated = true;
-
nm.dataview._updateColumns();
-
}
// If we're doing an autorefresh and the count decreases, preserve the
// selection or it will be lost when the grid rows are shuffled. Increases
— trunk/etemplate/js/et2_widget_grid.js (original)
+++ trunk/etemplate/js/et2_widget_grid.js Wed Mar 9 18:29:29 2016
@@ -107,12 +107,16 @@
// Initialize the cell description objects
for (var x = 0; x < w; x++)
{
-
// Some columns (nm) we do not parse into a boolean
-
var col_disabled = typeof _colData[x].disabled == 'boolean' ?
-
_colData[x].disabled :
-
this.getArrayMgr("content").parseBoolExpression(_colData[x].disabled);
cells[y][x] = {
"td": null,
"widget": null,
"colData": _colData[x],
"rowData": _rowData[y],
-
"disabled": col_disabled || _rowData[y].disabled,
"class": _colData[x]["class"],
"colSpan": 1,
"autoColSpan": false,
@@ -171,10 +175,22 @@
},
_fetchRowColData: function(columns, rows, colData, rowData) {
-
// Some things cannot be done inside a nextmatch - nm will do the expansion later
-
var nm = false;
-
var widget = this;
-
while(!nm && widget != this.getRoot())
-
{
-
nm = (widget._type == 'nextmatch');
-
widget = widget.getParent();
-
}
-
// Parse the columns tag
et2_filteredNodeIterator(columns, function(node, nodeName) {
var colDataEntry = this._getColDataEntry();
-
// This cannot be done inside a nm, it will expand it later
-
colDataEntry["disabled"] = nm ?
-
et2_readAttrWithDefault(node, "disabled", "") :
-
this.getArrayMgr("content")
.parseBoolExpression(et2_readAttrWithDefault(node, "disabled", ""));
if (nodeName == "column")
{
@@ -254,12 +270,6 @@
// Old etemplate checked first two widgets, or first two box children
// This cannot be done inside a nextmatch - nm will do the expansion later
var nm = false;
-
var widget = this;
-
while(!nm && widget != this.getRoot())
-
{
-
nm = (widget._type == 'nextmatch');
-
widget = widget.getParent();
-
}
if(nm)
{
// No further checks for repeated rows
— trunk/etemplate/templates/default/etemplate2.css (original)
+++ trunk/etemplate/templates/default/etemplate2.css Wed Mar 9 18:29:29 2016
@@ -1637,6 +1637,10 @@
table.egwGridView_outer.egwResizing .fixedWidth {
opacity: 0.5;
}
+table.egwGridView_outer thead tr th.noResize:hover {
- background-image: none;
- background-color: inherit;
+}
.egwResizeOverlay {
position: fixed;
width: 100%;
— trunk/pixelegg/css/mobile.css (original)
+++ trunk/pixelegg/css/mobile.css Wed Mar 9 18:29:29 2016
@@ -726,64 +726,14 @@
################################################################*/
- div#admin-categories-index {
- /*div#admin-categories-index{
- padding: 0px;
- }
- div#admin-categories-index div.ui-helper-clearfix {
- height: 0px;
- }
- div#admin-categories-index div.et2_hbox_right {
- margin-right: 0;
- padding: 0;
- }
- /ADD Button/
- button#admin-categories-index_add {
- width: 32px;
- /border: 1px solid #0C5DA5;/
- margin: 6px 2px;
- box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
- padding: -0.5em;
- background-color: #e6e6e6 !important;
- background-size: 16px 16px;
- -webkit-border-radius: 3px;
- -webkit-border-top-left-radius: 10px;
- -moz-border-radius: 3px;
- -moz-border-radius-topleft: 10px;
- border-radius: 3px;
- border-top-left-radius: 10px;
- height: 24px;
- margin: -2px 2px;
- }
- button#admin-categories-index_add:before {
- content: “”;
- font-size: 2em;
- color: #0c5da5;
- line-height: 0.6em;
- padding-left: 0.1em;
- padding-right: 100em;
- }
- button#admin-categories-index_add:active {
- background-color: #1aa200;
- }
- button#admin-categories-index_add:hover {
- background-color: #189800 !important;
- color: #ffc200;
- -webkit-box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.6);
- -moz-box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.6);
- box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.6);
- -webkit-border-radius: 3px;
- -webkit-border-top-left-radius: 10px;
- -moz-border-radius: 3px;
- -moz-border-radius-topleft: 10px;
- border-radius: 3px;
- border-top-left-radius: 10px;
- }
- button#admin-categories-index_add:active {
- background-color: #1aa200 !important;
- }
-
#admin-categories-index_filter {
- top: 8px;
- }
-
- // save space above nextmatch
- // set height to zero
- div.ui-helper-clearfix { height: 0px;}
+}/
/################################################################
— trunk/pixelegg/mobile/fw_mobile.css (original)
+++ trunk/pixelegg/mobile/fw_mobile.css Wed Mar 9 18:29:29 2016
@@ -737,64 +737,14 @@
################################################################*/
- div#admin-categories-index {
- /*div#admin-categories-index{
- padding: 0px;
- }
- div#admin-categories-index div.ui-helper-clearfix {
- height: 0px;
- }
- div#admin-categories-index div.et2_hbox_right {
- margin-right: 0;
- padding: 0;
- }
- /ADD Button/
- button#admin-categories-index_add {
- width: 32px;
- /border: 1px solid #0C5DA5;/
- margin: 6px 2px;
- box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
- padding: -0.5em;
- background-color: #e6e6e6 !important;
- background-size: 16px 16px;
- -webkit-border-radius: 3px;
- -webkit-border-top-left-radius: 10px;
- -moz-border-radius: 3px;
- -moz-border-radius-topleft: 10px;
- border-radius: 3px;
- border-top-left-radius: 10px;
- height: 24px;
- margin: -2px 2px;
- }
- button#admin-categories-index_add:before {
- content: “”;
- font-size: 2em;
- color: #0c5da5;
- line-height: 0.6em;
- padding-left: 0.1em;
- padding-right: 100em;
- }
- button#admin-categories-index_add:active {
- background-color: #1aa200;
- }
- button#admin-categories-index_add:hover {
- background-color: #189800 !important;
- color: #ffc200;
- -webkit-box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.6);
- -moz-box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.6);
- box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.6);
- -webkit-border-radius: 3px;
- -webkit-border-top-left-radius: 10px;
- -moz-border-radius: 3px;
- -moz-border-radius-topleft: 10px;
- border-radius: 3px;
- border-top-left-radius: 10px;
- }
- button#admin-categories-index_add:active {
- background-color: #1aa200 !important;
- }
-
#admin-categories-index_filter {
- top: 8px;
- }
-
- // save space above nextmatch
- // set height to zero
- div.ui-helper-clearfix { height: 0px;}
+}/
/################################################################
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs