This commit is contained in:
wangyidong
2017-10-17 14:04:11 +08:00
parent f289ed31b1
commit 735f0ad1d1
4 changed files with 34 additions and 2 deletions
+30 -1
View File
@@ -53,7 +53,11 @@ class datatable extends control
public function ajaxCustom($module, $method)
{
$account = $this->app->user->account;
$name = 'owner=' . $account . '&module=datatable&section=' . $module . ucfirst($method) . '&key=cols';
$target = $module . ucfirst($method);
$mode = isset($this->config->datatable->$target->mode) ? $this->config->datatable->$target->mode : 'table';
$key = $mode == 'datatable' ? 'cols' : 'tablecols';
$name = "owner=$account&module=datatable&section=$target&key=$key";
if($module == 'testtask')
{
$this->loadModel('testcase');
@@ -66,6 +70,9 @@ class datatable extends control
$this->config->testcase->datatable->fieldList['actions']['width'] = '100';
}
$this->view->module = $module;
$this->view->method = $method;
$module = zget($this->config->datatable->moduleAlias, $module, $module);
$this->view->cols = $this->datatable->getFieldList($module);
$this->view->setting = $this->loadModel('setting')->getItem($name);
@@ -73,4 +80,26 @@ class datatable extends control
$this->display();
}
/**
* Ajax reset cols
*
* @param string $module
* @param string $method
* @param string $confirm
* @access public
* @return void
*/
public function ajaxReset($module, $method, $confirm = 'no')
{
if($confirm == 'no') die(js::confirm($this->lang->datatable->confirmReset, inlink('ajaxReset', "module=$module&method=$method&confirm=yes")));
$account = $this->app->user->account;
$target = $module . ucfirst($method);
$mode = isset($this->config->datatable->$target->mode) ? $this->config->datatable->$target->mode : 'table';
$key = $mode == 'datatable' ? 'cols' : 'tablecols';
$this->loadModel('setting')->deleteItems("owner=$account&module=datatable&section=$target&key=$key");
die(js::reload('parent'));
}
}