public function index(request $req, $res)
{
$this->initRoute($req, $res);
$model = ModelsFactory::getModelWithRequest($req);
$this->data['items'] = $model->orderBy($this->pageOrderBy, $this->pageOrderType)->paginate($this->pagecount);
$this->data['items']->setPath($this->router->pathFor($this->data['all_e_link']));
$this->data['items']->pagenItems = UrlWindow::make($this->data['items']);
$this->data['fields'] = $this->getFields($model->getColumnsNames(), array('id'));
$userField = ModelsFactory::getModel('UserViewsSettings');
$userField = $userField->where('user_id', Session::get('user')['id'])->where('group', $this->data['all_e_link'])->where('code', 'show_fields_in_table')->first();
$this->data['showFields'] = array();
if ($userField) {
$this->data['showFields'] = (array) json_decode($userField->toArray()['value']);
$this->data['fields'] = $this->data['showFields'];
}
$this->data['allFields'] = array_diff($model->getColumnsNames(), $this->data['showFields']);
$this->render('admin\\dataTables.twig');
}