Przeglądaj źródła

fixed TableAjax missing primaryKey

Piotr Labudda 8 lat temu
rodzic
commit
63d2e9d19f
1 zmienionych plików z 4 dodań i 2 usunięć
  1. 4 2
      SE/se-lib/TableAjax.php

+ 4 - 2
SE/se-lib/TableAjax.php

@@ -2118,7 +2118,7 @@ class TableAjax extends ViewAjax {
 			}).then(function (response) {
 				return response.json()
 			}).then(function (data) {
-				if (priv.options.debug) console.log('loadDataAjax:fetch:update: request finished data:', data);
+				if (priv.options.debug) console.log('loadDataAjax:fetch:update: request finished response data:', data);
 				if ('success' == data.type) {
 					// p5UI__notifyAjaxCallback(data);
 					return data;
@@ -2129,6 +2129,7 @@ class TableAjax extends ViewAjax {
 				}
 				return null;
 			}).then(function (data) {
+				if (priv.options.debug) console.log('loadDataAjax:fetch:update: request finished data:', data);
 				if (!data) return;
 				if (data && data.cols) {
 					priv.setStateCols(data.cols, data.primaryKey);
@@ -2221,8 +2222,9 @@ class TableAjax extends ViewAjax {
 		};
 
 		priv.setStateCols = function(cols, primaryKey) {
+			if (priv.options.debug) console.log('priv.setStateCols: ', {primaryKey: primaryKey, cols: cols});
 			_state.cols = cols;
-			_state.primaryKey = primaryKey;
+			_state.primaryKey = primaryKey || _state.primaryKey;
 			// fix col name - props.column
 			$.each(_state.cols, function(col, props) {
 				props.column = col;