OpenSkill\Datatable\Views\DatatableView::script PHP Method

script() public method

Will render the javascript for the table
public script ( ) : string
return string the rendered view that represents the script
    public function script()
    {
        if (empty($this->columns)) {
            throw new \InvalidArgumentException("There are no columns defined");
        }
        return $this->viewFactory->make($this->scriptView, ['id' => $this->tableId, 'columns' => $this->columns, 'options' => $this->scriptOptions, 'callbacks' => $this->scriptCallbacks, 'endpoint' => $this->endpointURL])->render();
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testInvalidColumsScript()
 {
     $this->dtv->script();
 }