/** * Prepare options for rendering. * * @param array $options * @return array */ protected function prepareOptions(array $options = []) { $options = $this->datagridHelper->mergeOptions($this->options, $options); $options['attr']['data-field'] = $this->name; $options['attr']['data-title'] = $this->options['label']; $options['colAttrs'] = $this->datagridHelper->prepareAttributes($options['attr']); return $options; }
/** * Render the datagrid. * * @param $options * @param $columns * @param bool $showStart * @param bool $showColumns * @param bool $showEnd * @return string */ protected function render($options, $columns, $showStart, $showColumns, $showEnd) { $datagridOptions = $this->datagridHelper->mergeOptions($this->datagridOptions, $options); if (isset($datagridOptions['view']) && view()->exists($datagridOptions['view'])) { $datagridView = $datagridOptions['view']; } else { $datagridView = $this->datagridHelper->getConfig('datagrid_defaults.view'); } return $this->datagridHelper->getView()->make($datagridView)->with(compact('showStart', 'showColumns', 'showEnd'))->with('datagridOptions', $datagridOptions)->with('tableAttrs', $this->datagridHelper->prepareAttributes($this->getHtmlAttributes()))->with('columns', $columns)->with('exclude', $this->exclude)->with('data', $this->data)->render(); }