diff --git a/application/libraries/TableWidgetLib.php b/application/libraries/TableWidgetLib.php index e97e0d754..009103e68 100644 --- a/application/libraries/TableWidgetLib.php +++ b/application/libraries/TableWidgetLib.php @@ -119,8 +119,6 @@ class TableWidgetLib */ public function setSession($data) { - $data[TableWidgetLib::TABLE_UNIQUE_ID] = $this->_tableUniqueId; // the unique id of this table widget - setSessionElement(self::SESSION_NAME, $this->_tableUniqueId, $data); } @@ -190,15 +188,19 @@ class TableWidgetLib && isset($params[self::TABLE_UNIQUE_ID]) && !isEmptyString($params[self::TABLE_UNIQUE_ID])) { - $this->setTableUniqueId($params[self::TABLE_UNIQUE_ID]); + $tableUniqueId = $this->_ci->router->directory.$this->_ci->router->class.'/'. + $this->_ci->router->method.'/'. + $params[self::TABLE_UNIQUE_ID]; + + $this->setTableUniqueId($tableUniqueId); } } /** * Set the _tableUniqueId property */ - public function setTableUniqueId($filterUniqueId) + public function setTableUniqueId($tableUniqueId) { - $this->_tableUniqueId = $filterUniqueId; + $this->_tableUniqueId = $tableUniqueId; } } diff --git a/application/widgets/TableWidget.php b/application/widgets/TableWidget.php index 396ca3bb3..a0f64b291 100644 --- a/application/widgets/TableWidget.php +++ b/application/widgets/TableWidget.php @@ -59,7 +59,7 @@ class TableWidget extends Widget // NOTE: If it is NOT allowed then no data are loaded if ($this->tablewidgetlib->isAllowed($this->_requiredPermissions)) { - $this->_startTableWidget(); + $this->_startTableWidget($args[TableWidgetLib::TABLE_UNIQUE_ID]); } } @@ -244,7 +244,7 @@ class TableWidget extends Widget /** * Contains all the logic used to load all the data needed to the TableWidget */ - private function _startTableWidget() + private function _startTableWidget($tableUniqueId) { // Read the all session for this table widget $session = $this->tablewidgetlib->getSession(); @@ -297,6 +297,7 @@ class TableWidget extends Widget // Stores an array that contains all the data useful for $this->tablewidgetlib->setSession( array( + TableWidgetLib::TABLE_UNIQUE_ID => $tableUniqueId, // table unique id TableWidgetLib::SESSION_FIELDS => $this->tablewidgetlib->getExecutedQueryListFields(), // all the fields of the dataset TableWidgetLib::SESSION_COLUMNS_ALIASES => $this->_columnsAliases, // all the fields aliases TableWidgetLib::SESSION_ADDITIONAL_COLUMNS => $this->_additionalColumns, // additional columns diff --git a/public/js/TableWidget.js b/public/js/TableWidget.js index 44e66cabd..89e7cf3d5 100644 --- a/public/js/TableWidget.js +++ b/public/js/TableWidget.js @@ -42,6 +42,14 @@ var FHC_TableWidget = { //------------------------------------------------------------------------------------------------------------------ // Private methods + /** + * To retrive the page where the TableWidget is used, using the FHC_JS_DATA_STORAGE_OBJECT + */ + _getTableUniqueIdPrefix: function() { + + return FHC_JS_DATA_STORAGE_OBJECT.called_path + "/" + FHC_JS_DATA_STORAGE_OBJECT.called_method; + }, + /** * Utility method that checks if data contains an error and print that to the console * otherwise the TableWidget GUI is refreshed @@ -109,11 +117,10 @@ var FHC_TableWidget = { for (var tableWidgetsCounter = 0; tableWidgetsCounter < tableWidgetUniqueIdArray.length; tableWidgetsCounter++) { - FHC_AjaxClient.ajaxCallGet( "widgets/Tables/getTable", { - tableUniqueId: tableWidgetUniqueIdArray[tableWidgetsCounter] + tableUniqueId: FHC_TableWidget._getTableUniqueIdPrefix() + "/" + tableWidgetUniqueIdArray[tableWidgetsCounter] }, { successCallback: function(data, textStatus, jqXHR) {