|
@@ -77,14 +77,17 @@ class Route_ViewTableAjax extends RouteBase {
|
|
|
$acl = Core_AclHelper::getAclByNamespace($namespace, $forceTblAclInit = ('1' == V::get('_force', '', $_GET)));
|
|
$acl = Core_AclHelper::getAclByNamespace($namespace, $forceTblAclInit = ('1' == V::get('_force', '', $_GET)));
|
|
|
|
|
|
|
|
$forceFilterInit = array();
|
|
$forceFilterInit = array();
|
|
|
|
|
+ $requestDataFilters = array();
|
|
|
$filterInit = new stdClass();
|
|
$filterInit = new stdClass();
|
|
|
$filterInit->currSortCol = $acl->getPrimaryKeyField();
|
|
$filterInit->currSortCol = $acl->getPrimaryKeyField();
|
|
|
$filterInit->currSortFlip = 'desc';
|
|
$filterInit->currSortFlip = 'desc';
|
|
|
foreach ($_REQUEST as $k => $v) {
|
|
foreach ($_REQUEST as $k => $v) {
|
|
|
if (strlen($k) > 3 && substr($k, 0, 2) == 'f_' && !empty($v)) {// filter prefix
|
|
if (strlen($k) > 3 && substr($k, 0, 2) == 'f_' && !empty($v)) {// filter prefix
|
|
|
|
|
+ $requestDataFilters[$k] = $v;
|
|
|
$filterInit->$k = $v;
|
|
$filterInit->$k = $v;
|
|
|
}
|
|
}
|
|
|
else if (strlen($k) > 4 && substr($k, 0, 3) == 'sf_' && !empty($v)) {// special filter prefix
|
|
else if (strlen($k) > 4 && substr($k, 0, 3) == 'sf_' && !empty($v)) {// special filter prefix
|
|
|
|
|
+ $requestDataFilters[$k] = $v;
|
|
|
$filterInit->$k = $v;
|
|
$filterInit->$k = $v;
|
|
|
}
|
|
}
|
|
|
else if (strlen($k) > 4 && substr($k, 0, 3) == 'ff_' && !empty($v)) {// force filter prefix
|
|
else if (strlen($k) > 4 && substr($k, 0, 3) == 'ff_' && !empty($v)) {// force filter prefix
|
|
@@ -103,7 +106,21 @@ class Route_ViewTableAjax extends RouteBase {
|
|
|
'primaryKey' => V::get('childRefPK', '', $_GET),
|
|
'primaryKey' => V::get('childRefPK', '', $_GET),
|
|
|
];
|
|
];
|
|
|
$tbl = $this->getTableAjaxWidget($acl, $backRefFilter, $childRefFilter);
|
|
$tbl = $this->getTableAjaxWidget($acl, $backRefFilter, $childRefFilter);
|
|
|
- $tbl->setFilterInit($filterInit);
|
|
|
|
|
|
|
+ $lastDataFilters = $tbl->getFilters();
|
|
|
|
|
+ DBG::log([
|
|
|
|
|
+ '$requestDataFilters' => $requestDataFilters,
|
|
|
|
|
+ '$lastDataFilters' => $lastDataFilters,
|
|
|
|
|
+ ], 'array', "TODO:BUG:filters");
|
|
|
|
|
+ if ($lastDataFilters) {
|
|
|
|
|
+ // ok, use last filters
|
|
|
|
|
+ } else if (empty($requestDataFilters)) {
|
|
|
|
|
+ $tbl->setFilterInit([
|
|
|
|
|
+ 'currSortCol' => $acl->getPrimaryKeyField(),
|
|
|
|
|
+ 'currSortFlip' => 'desc',
|
|
|
|
|
+ ]);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $tbl->setFilterInit($filterInit);
|
|
|
|
|
+ }
|
|
|
if (!empty($forceFilterInit)) $tbl->setForceFilterInit($forceFilterInit);
|
|
if (!empty($forceFilterInit)) $tbl->setForceFilterInit($forceFilterInit);
|
|
|
if (V::get('DBG_INST', '', $_GET)) { // TODO: TEST namespace
|
|
if (V::get('DBG_INST', '', $_GET)) { // TODO: TEST namespace
|
|
|
$siblings = ACL::getNamespaceSiblings($namespace);
|
|
$siblings = ACL::getNamespaceSiblings($namespace);
|