Action_Helper_Datatable::dispatch PHP Method

dispatch() public method

Dispatch table
public dispatch ( ) : void
return void
    public function dispatch()
    {
        $view = $this->getActionController()->initView();
        $params = $this->getRequest()->getParams();
        if (empty($params['format'])) {
            // render table
            $view->iOptions = $this->iOptions;
            $view->cols = $this->cols;
            return;
        }
        // get data
        $rows = array();
        $handle = $this->handle;
        $data = $this->dataSource->getData($params, $this->cols);
        foreach ($data as $entity) {
            $rows[] = $handle($entity);
        }
        // set data
        $view->iTotalRecords = $this->dataSource->getCount();
        $view->iTotalDisplayRecords = $this->dataSource->getCount($params, $this->cols);
        $view->aaData = $rows;
        $view->sEcho = !empty($params['sEcho']) ? $params['sEcho'] : 0;
    }