* Add remove button for custom query list.

This commit is contained in:
daitingting
2023-06-12 01:43:10 +00:00
parent 9b07978ea0
commit 8f5db9f448
2 changed files with 19 additions and 7 deletions
+17 -7
View File
@@ -71,13 +71,23 @@ class featureBar extends wg
foreach($moreSelects as $key => $text)
{
$subItems[] = array
(
'text' => $text,
'active' => $key == $current,
'url' => ($callback instanceof \Closure) ? $callback($key, $text) : str_replace('{key}', $key, $link),
'attrs' => ['data-id' => $key, 'data-load' => 'table']
);
$subItem = array();
$subItem['text'] = $text;
$subItem['active'] = $key == $current;
$subItem['url'] = ($callback instanceof \Closure) ? $callback($key, $text) : str_replace('{key}', $key, $link);
$subItem['attrs'] = ['data-id' => $key, 'data-load' => 'table'];
if($item->name == 'QUERY')
{
$closeLink = createLink('search', 'ajaxRemoveMenu', "queryID={$key}");
$loadUrl = $subItem['url'] . '#featureBar';
$subItem['className'] = 'flex-auto';
$subItem['rootClass'] = 'row gap-0';
$subItem['rootChildren'] = array(jsRaw("zui.h('a', {className: 'ajax-submit', 'data-url': '{$closeLink}', 'data-load': '{$loadUrl}'}, zui.h('span', {className: 'close'}))"));
}
$subItems[] = $subItem;
if($key === $current)
{
+2
View File
@@ -174,6 +174,8 @@ class search extends control
public function ajaxRemoveMenu($queryID)
{
$this->dao->update(TABLE_USERQUERY)->set('shortcut')->eq(0)->where('id')->eq($queryID)->exec();
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
return $this->send(array('result' => 'success'));
}
/**