|
@@ -24,6 +24,7 @@ class TableAjax extends ViewAjax {
|
|
|
private $_filterInit = null;
|
|
private $_filterInit = null;
|
|
|
private $_forceFilterInit = null;
|
|
private $_forceFilterInit = null;
|
|
|
private $_showProcesInit = true;
|
|
private $_showProcesInit = true;
|
|
|
|
|
+ private $_useUserTableFilter = false;
|
|
|
public $syncUrl = null;
|
|
public $syncUrl = null;
|
|
|
|
|
|
|
|
public function __construct($tblAcl) {
|
|
public function __construct($tblAcl) {
|
|
@@ -58,6 +59,10 @@ class TableAjax extends ViewAjax {
|
|
|
$this->_showProcesInit = $bool;
|
|
$this->_showProcesInit = $bool;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function showUserTableFilter($url = null) {
|
|
|
|
|
+ $this->_useUserTableFilter = $url;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private function _hasStateFilterInit() {
|
|
private function _hasStateFilterInit() {
|
|
|
return array_key_exists($this->_htmlID, $_SESSION['TableAjax_Cache']) && array_key_exists('_filterInit', $_SESSION['TableAjax_Cache'][$this->_htmlID]);
|
|
return array_key_exists($this->_htmlID, $_SESSION['TableAjax_Cache']) && array_key_exists('_filterInit', $_SESSION['TableAjax_Cache'][$this->_htmlID]);
|
|
|
}
|
|
}
|
|
@@ -2877,36 +2882,38 @@ var p5UI_TableAjax_generateFunctionNode = function(funObj, rowPK, props) {
|
|
|
};
|
|
};
|
|
|
_state._modelColFilter.saveBtn.on('click', priv.modelColFilter_saveBtnClicked)
|
|
_state._modelColFilter.saveBtn.on('click', priv.modelColFilter_saveBtnClicked)
|
|
|
|
|
|
|
|
- fetch('<?= Request::getPathUri() . "index.php?_route=ViewTableAjax&_task=getUserTableFilterAjax" ?>', {
|
|
|
|
|
- method: 'POST',
|
|
|
|
|
- headers: {
|
|
|
|
|
- 'Content-Type': 'application/json'
|
|
|
|
|
- },
|
|
|
|
|
- credentials: 'same-origin',// add cookies
|
|
|
|
|
- body: JSON.stringify({
|
|
|
|
|
- namespace: '<?= $acl->getNamespace(); ?>',
|
|
|
|
|
- })
|
|
|
|
|
- }).then(function (response) {
|
|
|
|
|
- return response.json()
|
|
|
|
|
- }).then(function (result) {
|
|
|
|
|
- if ('success' == result.type) {
|
|
|
|
|
- // p5UI__notifyAjaxCallback(result)
|
|
|
|
|
- _state._modelColFilter.filters = _state._modelColFilter.filters.filter(function (filter) {
|
|
|
|
|
- return ('all' === filter.name || 'most_used' == filter.name)
|
|
|
|
|
- }).concat(Object.keys(result.data).map(function (fltr) {
|
|
|
|
|
- return {
|
|
|
|
|
- name: fltr,
|
|
|
|
|
- label: fltr,
|
|
|
|
|
- visibleCols: result.data[fltr].split(',')
|
|
|
|
|
- }
|
|
|
|
|
- }))
|
|
|
|
|
- jQuery(_uiNodeCont).trigger('TableAjax:render', ['foot__columnPicker']);
|
|
|
|
|
- } else {
|
|
|
|
|
- p5UI__notifyAjaxCallback(result)
|
|
|
|
|
- }
|
|
|
|
|
- }).catch(function (e) {
|
|
|
|
|
- // TODO: show error ("ajax response error: " + e)
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ if (priv.options.userTableFilterUrl) {
|
|
|
|
|
+ fetch(priv.options.userTableFilterUrl, {
|
|
|
|
|
+ method: 'POST',
|
|
|
|
|
+ headers: {
|
|
|
|
|
+ 'Content-Type': 'application/json'
|
|
|
|
|
+ },
|
|
|
|
|
+ credentials: 'same-origin',// add cookies
|
|
|
|
|
+ body: JSON.stringify({
|
|
|
|
|
+ namespace: '<?= $acl->getNamespace(); ?>',
|
|
|
|
|
+ })
|
|
|
|
|
+ }).then(function (response) {
|
|
|
|
|
+ return response.json()
|
|
|
|
|
+ }).then(function (result) {
|
|
|
|
|
+ if ('success' == result.type) {
|
|
|
|
|
+ // p5UI__notifyAjaxCallback(result)
|
|
|
|
|
+ _state._modelColFilter.filters = _state._modelColFilter.filters.filter(function (filter) {
|
|
|
|
|
+ return ('all' === filter.name || 'most_used' == filter.name)
|
|
|
|
|
+ }).concat(Object.keys(result.data).map(function (fltr) {
|
|
|
|
|
+ return {
|
|
|
|
|
+ name: fltr,
|
|
|
|
|
+ label: fltr,
|
|
|
|
|
+ visibleCols: result.data[fltr].split(',')
|
|
|
|
|
+ }
|
|
|
|
|
+ }))
|
|
|
|
|
+ jQuery(_uiNodeCont).trigger('TableAjax:render', ['foot__columnPicker']);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ p5UI__notifyAjaxCallback(result)
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch(function (e) {
|
|
|
|
|
+ // TODO: show error ("ajax response error: " + e)
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
priv.modelColFilter_onClickRemoveFilter = function (e) {
|
|
priv.modelColFilter_onClickRemoveFilter = function (e) {
|
|
@@ -3696,6 +3703,7 @@ function TableAjax__HIST_Route(args) {
|
|
|
jQuery(document).ready(function(){
|
|
jQuery(document).ready(function(){
|
|
|
jQuery('#<?php echo $this->_htmlID; ?>').TableAjax({
|
|
jQuery('#<?php echo $this->_htmlID; ?>').TableAjax({
|
|
|
url: '<?= $this->syncUrl; ?>&_hash=<?= $this->_htmlID; ?>&_task=loadDataAjax',// priv.options.url
|
|
url: '<?= $this->syncUrl; ?>&_hash=<?= $this->_htmlID; ?>&_task=loadDataAjax',// priv.options.url
|
|
|
|
|
+ userTableFilterUrl: '<?= ($this->_useUserTableFilter) ? $this->_useUserTableFilter : ''; ?>',
|
|
|
columnPicker: true,
|
|
columnPicker: true,
|
|
|
filter: true,
|
|
filter: true,
|
|
|
filterInit: <?php echo json_encode($filterInit); ?>,
|
|
filterInit: <?php echo json_encode($filterInit); ?>,
|