feat(admin): add table order sorting functionality
初始化表格排序,js排序操作传递到服务端
This commit is contained in:
@@ -88,9 +88,24 @@ class AdminController extends BaseController
|
||||
parent::initialize();
|
||||
$this->adminUid = request()->adminUserInfo['id'] ?? 0;
|
||||
$this->isDemo = env('EASYADMIN.IS_DEMO', false);
|
||||
$this->setOrder();
|
||||
$this->viewInit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化排序
|
||||
* @return $this
|
||||
*/
|
||||
public function setOrder(): static
|
||||
{
|
||||
$tableOrder = $this->request->param('tableOrder/s', '');
|
||||
if (!empty($tableOrder)) {
|
||||
[$orderField, $orderType] = explode(' ', $tableOrder);
|
||||
$this->sort = [$orderField => $orderType];
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板变量赋值
|
||||
* @param array|string $name 模板变量
|
||||
|
||||
Reference in New Issue
Block a user