Ver Fonte

TableAjax fix bug in set init filters without columns loaded, change ui for filters

Piotr Labudda há 10 anos atrás
pai
commit
b56b092109
1 ficheiros alterados com 16 adições e 14 exclusões
  1. 16 14
      SE/se-lib/TableAjax.php

+ 16 - 14
SE/se-lib/TableAjax.php

@@ -267,7 +267,7 @@ class TableAjax extends ViewAjax {
 .AjaxTableCont .btn-toolbar {margin:2px 0 0 0;}
 .AjaxTableCont .btn-toolbar .btn-group {vertical-align:top;}
 .AjaxTable input[type=checkbox] {margin:0;padding:0;height:13px;}
-.AjaxTable input[type=text].filter {margin:0;padding:0;box-shadow:none;width:100%;background:#eee;float:left;color:#000;}
+.AjaxTable input[type=text].filter {margin:0;padding:0 5px;box-shadow:none;width:100%;background:#eee;color:#000;}
 .AjaxTable input[type=text].filter {border-width:2px 0;border-color:#eee;border-style:solid;}
 .AjaxTable input[type=text].filter-active {border-color:#00ACCC;}
 .AjaxTable .date-wrap {width:100%;min-width:115px;}
@@ -282,7 +282,6 @@ class TableAjax extends ViewAjax {
 .AjaxTableCont .tblAjax__inlineEditBox .loading-info {display:block; padding:0 0 0 20px; background:url(./icon/loading.gif) no-repeat left top;}
 .AjaxTableCont .loading-info {display:none;}
 .AjaxTableCont .tblAjax__inlineEditBox .loading-info {display:block;}
-.AjaxTable .stickyCol2 input[type=text].filter {width:50px;}
 .AjaxTableCont .table {margin-bottom:0px;}
 .AjaxTableCont .stickyCol1 a { color:#333; }
 .AjaxTableCont .stickyCol1 a:hover { color:#337AB7; text-decoration:none; }
@@ -646,8 +645,8 @@ class TableAjax extends ViewAjax {
 		priv.initialRender = function () {
 			_uiNode$Table = $('<table class="AjaxTable table table-striped table-hover table-bordered table-condensed"></table>').appendTo(_uiNodeCont);
 				_head = $('<thead></thead>').prependTo(_uiNode$Table);
-					_headSort = $('<tr class="sort"></tr>').prependTo(_head);
-					_headFilter = $('<tr class="filter"></tr>').appendTo(_head);
+					_headSort = $('<tr class="sort tblAjax__head__sort"></tr>').prependTo(_head);
+					_headFilter = $('<tr class="filter tblAjax__head__filter"></tr>').appendTo(_head);
 				_body = $('<tbody></tbody>').insertAfter(_head);
 			$('<tfoot></tfoot>').insertAfter(_body);
 			_foot = $('<div class="foot tblAjax__footer"></div>').insertAfter(_uiNodeCont);
@@ -976,7 +975,7 @@ class TableAjax extends ViewAjax {
 				top:'auto',
 				width:'' + stickyCol1Width + 'px',
 			});
-			_uiNode$Table.find('.filter').find('.stickyCol1').css({height:'34px'});
+			//_uiNode$Table.find('.filter').find('.stickyCol1').css({height:'34px'});
 			var sortStickyColHeight = _uiNode$Table.find('.sort').find('th:last').outerHeight();
 			_uiNode$Table.find('.sort').find('.stickyCol1').css({height: sortStickyColHeight + 'px'});
 			_uiNode$Table.find('.sort').find('.stickyCol2').css({height: sortStickyColHeight + 'px'});
@@ -998,10 +997,10 @@ class TableAjax extends ViewAjax {
 
 		priv.renderTableTheadSort = function() {
 			var nodeClass = 'tblAjax__' + 'head__sort',
-					currentNode = _uiNode$Table.find('thead').find('.sort'),
+					currentNode = _uiNode$Table.find('thead').find('.' + nodeClass),
 					node;
 			// currentNode.find('i').tooltip('hide');
-			node = $('<tr class="sort"></tr>');
+			node = $('<tr class="sort ' + nodeClass + '"></tr>');
 			//create the functions column
 			if (priv.options.rowFunctions || priv.options.filtersClean) {
 				var headCell = $('<th class="text-right head-info stickyCol1"></th>').appendTo(node);
@@ -1133,10 +1132,10 @@ class TableAjax extends ViewAjax {
 
 		priv.renderTableTheadFilter = function() {
 			var nodeClass = 'tblAjax__' + 'head__filter',
-					currentNode = _uiNode$Table.find('thead').find('.filter'),
+					currentNode = _uiNode$Table.find('thead').find('.' + nodeClass),
 					node;
 			// currentNode.find('i').tooltip('hide');
-			node = $('<tr class="filter"></tr>');
+			node = $('<tr class="filter ' + nodeClass + '"></tr>');
 			//_head.find(".filter").remove();
 			//_headFilter = $('<tr class="filter"></tr>').appendTo(_head);
 			var headCell;
@@ -1147,6 +1146,7 @@ class TableAjax extends ViewAjax {
 			//create the functions column
 			if (priv.options.rowFunctions || priv.options.filtersClean) {
 				var headCell = $('<th class="text-right stickyCol1"></th>').appendTo(node);
+				headCell.css({padding: '0'});
 				if (priv.options.filtersClean) {
 					var elem = $('<button title="Kasuj filtry" class="btn btn-xs btn-link glyphicon glyphicon-remove"></button>').appendTo(headCell);
 					elem.on('click', priv.filtersClean);
@@ -1191,6 +1191,7 @@ class TableAjax extends ViewAjax {
 
 				if (!props.hidden) {
 					headCell = $('<th></th>').appendTo(node);
+					headCell.css({padding: '0'});
 					if (i == 1) headCell.addClass('stickyCol2');
 
 					// @mark MarkTableAjaxFilterColType
@@ -1276,7 +1277,8 @@ class TableAjax extends ViewAjax {
 					if (elem && props.filter) {
 						$.map(_state.filters.filterCols, function (colProps, col) {
 							if (col == column) {
-								if (colProps.col.type == 'bool') {
+								var columnSettings = _data.cols[col];
+								if (columnSettings.type == 'bool') {
 									if (colProps.filter) elem.prop('checked', true).removeClass('indeterminate');
 									else if (!colProps.filter) elem.prop('checked', false).removeClass('indeterminate');
 									else if (colProps.filter == '') elem.addClass('indeterminate');
@@ -1716,7 +1718,7 @@ class TableAjax extends ViewAjax {
 								//add the filter to the filter array
 								_state.filters.filterCols[colName] = {
 									filter: fltrValue,
-									col: _data.cols[colName]
+									colName: colName
 								};
 							}
 						});
@@ -1842,7 +1844,7 @@ class TableAjax extends ViewAjax {
 						if (fltr.substr(0, 2) == 'f_') {
 							newFilterCols[fltr.substr(2)] = {
 								filter: fltrProps,
-								col: _data.cols[fltr.substr(2)]
+								colName: fltr.substr(2)
 							};
 						}
 						else if (fltr.substr(0, 3) == 'sf_') {
@@ -1981,7 +1983,7 @@ class TableAjax extends ViewAjax {
 			//add the filter to the filter array
 			_state.filters.filterCols[col.column] = {
 				filter: filter,
-				col: col
+				colName: col.column
 			};
 
 			//wait a few deciseconds before filtering
@@ -2150,7 +2152,7 @@ class TableAjax extends ViewAjax {
 							_filterFields[column].val(filter);
 							_state.filters.filterCols[column] = {
 								filter: filter,
-								col: _data.cols[column]
+								colName: column
 							};
 							priv.filter();
 						}