فهرست منبع

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

Piotr Labudda 10 سال پیش
والد
کامیت
b56b092109
1فایلهای تغییر یافته به همراه16 افزوده شده و 14 حذف شده
  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 {margin:2px 0 0 0;}
 .AjaxTableCont .btn-toolbar .btn-group {vertical-align:top;}
 .AjaxTableCont .btn-toolbar .btn-group {vertical-align:top;}
 .AjaxTable input[type=checkbox] {margin:0;padding:0;height:13px;}
 .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 {border-width:2px 0;border-color:#eee;border-style:solid;}
 .AjaxTable input[type=text].filter-active {border-color:#00ACCC;}
 .AjaxTable input[type=text].filter-active {border-color:#00ACCC;}
 .AjaxTable .date-wrap {width:100%;min-width:115px;}
 .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 .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 .loading-info {display:none;}
 .AjaxTableCont .tblAjax__inlineEditBox .loading-info {display:block;}
 .AjaxTableCont .tblAjax__inlineEditBox .loading-info {display:block;}
-.AjaxTable .stickyCol2 input[type=text].filter {width:50px;}
 .AjaxTableCont .table {margin-bottom:0px;}
 .AjaxTableCont .table {margin-bottom:0px;}
 .AjaxTableCont .stickyCol1 a { color:#333; }
 .AjaxTableCont .stickyCol1 a { color:#333; }
 .AjaxTableCont .stickyCol1 a:hover { color:#337AB7; text-decoration:none; }
 .AjaxTableCont .stickyCol1 a:hover { color:#337AB7; text-decoration:none; }
@@ -646,8 +645,8 @@ class TableAjax extends ViewAjax {
 		priv.initialRender = function () {
 		priv.initialRender = function () {
 			_uiNode$Table = $('<table class="AjaxTable table table-striped table-hover table-bordered table-condensed"></table>').appendTo(_uiNodeCont);
 			_uiNode$Table = $('<table class="AjaxTable table table-striped table-hover table-bordered table-condensed"></table>').appendTo(_uiNodeCont);
 				_head = $('<thead></thead>').prependTo(_uiNode$Table);
 				_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);
 				_body = $('<tbody></tbody>').insertAfter(_head);
 			$('<tfoot></tfoot>').insertAfter(_body);
 			$('<tfoot></tfoot>').insertAfter(_body);
 			_foot = $('<div class="foot tblAjax__footer"></div>').insertAfter(_uiNodeCont);
 			_foot = $('<div class="foot tblAjax__footer"></div>').insertAfter(_uiNodeCont);
@@ -976,7 +975,7 @@ class TableAjax extends ViewAjax {
 				top:'auto',
 				top:'auto',
 				width:'' + stickyCol1Width + 'px',
 				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();
 			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('.stickyCol1').css({height: sortStickyColHeight + 'px'});
 			_uiNode$Table.find('.sort').find('.stickyCol2').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() {
 		priv.renderTableTheadSort = function() {
 			var nodeClass = 'tblAjax__' + 'head__sort',
 			var nodeClass = 'tblAjax__' + 'head__sort',
-					currentNode = _uiNode$Table.find('thead').find('.sort'),
+					currentNode = _uiNode$Table.find('thead').find('.' + nodeClass),
 					node;
 					node;
 			// currentNode.find('i').tooltip('hide');
 			// currentNode.find('i').tooltip('hide');
-			node = $('<tr class="sort"></tr>');
+			node = $('<tr class="sort ' + nodeClass + '"></tr>');
 			//create the functions column
 			//create the functions column
 			if (priv.options.rowFunctions || priv.options.filtersClean) {
 			if (priv.options.rowFunctions || priv.options.filtersClean) {
 				var headCell = $('<th class="text-right head-info stickyCol1"></th>').appendTo(node);
 				var headCell = $('<th class="text-right head-info stickyCol1"></th>').appendTo(node);
@@ -1133,10 +1132,10 @@ class TableAjax extends ViewAjax {
 
 
 		priv.renderTableTheadFilter = function() {
 		priv.renderTableTheadFilter = function() {
 			var nodeClass = 'tblAjax__' + 'head__filter',
 			var nodeClass = 'tblAjax__' + 'head__filter',
-					currentNode = _uiNode$Table.find('thead').find('.filter'),
+					currentNode = _uiNode$Table.find('thead').find('.' + nodeClass),
 					node;
 					node;
 			// currentNode.find('i').tooltip('hide');
 			// currentNode.find('i').tooltip('hide');
-			node = $('<tr class="filter"></tr>');
+			node = $('<tr class="filter ' + nodeClass + '"></tr>');
 			//_head.find(".filter").remove();
 			//_head.find(".filter").remove();
 			//_headFilter = $('<tr class="filter"></tr>').appendTo(_head);
 			//_headFilter = $('<tr class="filter"></tr>').appendTo(_head);
 			var headCell;
 			var headCell;
@@ -1147,6 +1146,7 @@ class TableAjax extends ViewAjax {
 			//create the functions column
 			//create the functions column
 			if (priv.options.rowFunctions || priv.options.filtersClean) {
 			if (priv.options.rowFunctions || priv.options.filtersClean) {
 				var headCell = $('<th class="text-right stickyCol1"></th>').appendTo(node);
 				var headCell = $('<th class="text-right stickyCol1"></th>').appendTo(node);
+				headCell.css({padding: '0'});
 				if (priv.options.filtersClean) {
 				if (priv.options.filtersClean) {
 					var elem = $('<button title="Kasuj filtry" class="btn btn-xs btn-link glyphicon glyphicon-remove"></button>').appendTo(headCell);
 					var elem = $('<button title="Kasuj filtry" class="btn btn-xs btn-link glyphicon glyphicon-remove"></button>').appendTo(headCell);
 					elem.on('click', priv.filtersClean);
 					elem.on('click', priv.filtersClean);
@@ -1191,6 +1191,7 @@ class TableAjax extends ViewAjax {
 
 
 				if (!props.hidden) {
 				if (!props.hidden) {
 					headCell = $('<th></th>').appendTo(node);
 					headCell = $('<th></th>').appendTo(node);
+					headCell.css({padding: '0'});
 					if (i == 1) headCell.addClass('stickyCol2');
 					if (i == 1) headCell.addClass('stickyCol2');
 
 
 					// @mark MarkTableAjaxFilterColType
 					// @mark MarkTableAjaxFilterColType
@@ -1276,7 +1277,8 @@ class TableAjax extends ViewAjax {
 					if (elem && props.filter) {
 					if (elem && props.filter) {
 						$.map(_state.filters.filterCols, function (colProps, col) {
 						$.map(_state.filters.filterCols, function (colProps, col) {
 							if (col == column) {
 							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');
 									if (colProps.filter) elem.prop('checked', true).removeClass('indeterminate');
 									else if (!colProps.filter) elem.prop('checked', false).removeClass('indeterminate');
 									else if (!colProps.filter) elem.prop('checked', false).removeClass('indeterminate');
 									else if (colProps.filter == '') elem.addClass('indeterminate');
 									else if (colProps.filter == '') elem.addClass('indeterminate');
@@ -1716,7 +1718,7 @@ class TableAjax extends ViewAjax {
 								//add the filter to the filter array
 								//add the filter to the filter array
 								_state.filters.filterCols[colName] = {
 								_state.filters.filterCols[colName] = {
 									filter: fltrValue,
 									filter: fltrValue,
-									col: _data.cols[colName]
+									colName: colName
 								};
 								};
 							}
 							}
 						});
 						});
@@ -1842,7 +1844,7 @@ class TableAjax extends ViewAjax {
 						if (fltr.substr(0, 2) == 'f_') {
 						if (fltr.substr(0, 2) == 'f_') {
 							newFilterCols[fltr.substr(2)] = {
 							newFilterCols[fltr.substr(2)] = {
 								filter: fltrProps,
 								filter: fltrProps,
-								col: _data.cols[fltr.substr(2)]
+								colName: fltr.substr(2)
 							};
 							};
 						}
 						}
 						else if (fltr.substr(0, 3) == 'sf_') {
 						else if (fltr.substr(0, 3) == 'sf_') {
@@ -1981,7 +1983,7 @@ class TableAjax extends ViewAjax {
 			//add the filter to the filter array
 			//add the filter to the filter array
 			_state.filters.filterCols[col.column] = {
 			_state.filters.filterCols[col.column] = {
 				filter: filter,
 				filter: filter,
-				col: col
+				colName: col.column
 			};
 			};
 
 
 			//wait a few deciseconds before filtering
 			//wait a few deciseconds before filtering
@@ -2150,7 +2152,7 @@ class TableAjax extends ViewAjax {
 							_filterFields[column].val(filter);
 							_filterFields[column].val(filter);
 							_state.filters.filterCols[column] = {
 							_state.filters.filterCols[column] = {
 								filter: filter,
 								filter: filter,
-								col: _data.cols[column]
+								colName: column
 							};
 							};
 							priv.filter();
 							priv.filter();
 						}
 						}