app->user->account;
- $name = 'owner=' . $account . '&module=datatable§ion=' . $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§ion=$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§ion=$target&key=$key");
+ die(js::reload('parent'));
+ }
}
diff --git a/module/datatable/lang/zh-cn.php b/module/datatable/lang/zh-cn.php
index bfbc7015d9..94b051d384 100644
--- a/module/datatable/lang/zh-cn.php
+++ b/module/datatable/lang/zh-cn.php
@@ -4,12 +4,14 @@ $lang->datatable->common = '数据表格';
$lang->datatable->width = '宽度';
$lang->datatable->show = '显示';
$lang->datatable->hide = '隐藏';
+$lang->datatable->reset = '恢复默认';
$lang->datatable->custom = '自定义列';
$lang->datatable->customTip = '勾选需要显示的列';
$lang->datatable->switchToTable = '切换到简单表格';
$lang->datatable->switchToDatatable = '切换到高级表格';
$lang->datatable->required = '必选';
+$lang->datatable->confirmReset = '是否恢复默认设置?';
$lang->datatable->branch = '分支';
$lang->datatable->platform = '平台';
diff --git a/module/datatable/view/ajaxcustom.html.php b/module/datatable/view/ajaxcustom.html.php
index b55daf57ad..945fa25946 100644
--- a/module/datatable/view/ajaxcustom.html.php
+++ b/module/datatable/view/ajaxcustom.html.php
@@ -71,6 +71,7 @@
+ datatable->reset, 'hiddenwin', "class='btn btn-default'");?>