PHP Class Yajra\Datatables\Html\Builder

Datei anzeigen Open project: yajra/laravel-datatables-oracle Class Usage Examples

Public Properties

Property Type Description
$collection Illuminate\Support\Collection
$config Illuminate\Contracts\Config\Repository
$form Collective\Html\FormBuilder
$html Collective\Html\HtmlBuilder
$url Illuminate\Routing\UrlGenerator
$view Illuminate\Contracts\View\Factory

Protected Properties

Property Type Description
$ajax string | array
$attributes array
$tableAttributes array
$template string
$validCallbacks array Lists of valid DataTables Callbacks.

Public Methods

Method Description
__construct ( Illuminate\Contracts\Config\Repository $config, Illuminate\Contracts\View\Factory $view, HtmlBuilder $html, UrlGenerator $url, FormBuilder $form )
add ( Yajra\Datatables\Html\Column $column ) Add a Column object in collection.
addAction ( array $attributes = [] ) Add a action column.
addCheckbox ( array $attributes = [] ) Add a checkbox column.
addColumn ( array $attributes ) Add a column in collection using attributes.
addIndex ( array $attributes = [] ) Add a index column.
ajax ( string | array $attributes ) Setup ajax parameter
columns ( array $columns ) Set datatables columns from array definition.
generateScripts ( ) : string Get generated raw scripts.
getColumns ( ) : Collection Get collection of columns.
getQualifiedTitle ( string $title ) : string Convert string into a readable title.
getTableAttribute ( string $attribute ) : mixed Retrieves HTML table attribute value.
parameterize ( array $attributes = [] ) : string Generate DataTables js parameters.
parameters ( array $attributes = [] ) Configure DataTable's parameters.
scripts ( null $script = null, array $attributes = ['type' => 'text/javascript'] ) : string Generate DataTable javascript.
setTableAttribute ( string | array $attribute, mixed $value = null ) Sets HTML table attribute(s).
setTableAttributes ( array $attributes ) Sets multiple HTML table attributes at once.
setTemplate ( string $template ) Set custom javascript template.
setTitle ( string $title, array $attributes ) : array Set title attribute of an array if not set.
table ( array $attributes = [], boolean $drawFooter = false ) : string Generate DataTable's table html.

Protected Methods

Method Description
decodeAjaxDataFunction ( string $function, string $json ) : string Decode ajax data method.
decodeCallbackFunctions ( array $callbackFunctions, string $json ) : string Decode DataTables callbacks function.
decodeColumnFunctions ( array $columnFunctions, string $json ) : string Decode columns render functions.
encodeAjaxDataFunction ( array $parameters ) : mixed Encode ajax data function param.
encodeCallbackFunctions ( array $parameters ) : array Encode DataTables callbacks function.
encodeColumnFunctions ( array $parameters ) : array Encode columns render function.
template ( ) : string Get javascript template to use.

Private Methods

Method Description
compileCallback ( mixed $callback ) : mixed | string Compile DataTable callback value.
compileTableFooter ( ) : array Compile table footer contents.
compileTableHeaders ( ) : array Compile table headers and to support responsive extension.

Method Details

__construct() public method

public __construct ( Illuminate\Contracts\Config\Repository $config, Illuminate\Contracts\View\Factory $view, HtmlBuilder $html, UrlGenerator $url, FormBuilder $form )
$config Illuminate\Contracts\Config\Repository
$view Illuminate\Contracts\View\Factory
$html Collective\Html\HtmlBuilder
$url Illuminate\Routing\UrlGenerator
$form Collective\Html\FormBuilder

add() public method

Add a Column object in collection.
public add ( Yajra\Datatables\Html\Column $column )
$column Yajra\Datatables\Html\Column

addAction() public method

Add a action column.
public addAction ( array $attributes = [] )
$attributes array

addCheckbox() public method

Add a checkbox column.
public addCheckbox ( array $attributes = [] )
$attributes array

addColumn() public method

Add a column in collection using attributes.
public addColumn ( array $attributes )
$attributes array

addIndex() public method

Add a index column.
public addIndex ( array $attributes = [] )
$attributes array

ajax() public method

Setup ajax parameter
public ajax ( string | array $attributes )
$attributes string | array

columns() public method

Set datatables columns from array definition.
public columns ( array $columns )
$columns array

decodeAjaxDataFunction() protected method

Decode ajax data method.
protected decodeAjaxDataFunction ( string $function, string $json ) : string
$function string
$json string
return string

decodeCallbackFunctions() protected method

Decode DataTables callbacks function.
protected decodeCallbackFunctions ( array $callbackFunctions, string $json ) : string
$callbackFunctions array
$json string
return string

decodeColumnFunctions() protected method

Decode columns render functions.
protected decodeColumnFunctions ( array $columnFunctions, string $json ) : string
$columnFunctions array
$json string
return string

encodeAjaxDataFunction() protected method

Encode ajax data function param.
protected encodeAjaxDataFunction ( array $parameters ) : mixed
$parameters array
return mixed

encodeCallbackFunctions() protected method

Encode DataTables callbacks function.
protected encodeCallbackFunctions ( array $parameters ) : array
$parameters array
return array

encodeColumnFunctions() protected method

Encode columns render function.
protected encodeColumnFunctions ( array $parameters ) : array
$parameters array
return array

generateScripts() public method

Get generated raw scripts.
public generateScripts ( ) : string
return string

getColumns() public method

Get collection of columns.
public getColumns ( ) : Collection
return Illuminate\Support\Collection

getQualifiedTitle() public method

Convert string into a readable title.
public getQualifiedTitle ( string $title ) : string
$title string
return string

getTableAttribute() public method

Retrieves HTML table attribute value.
public getTableAttribute ( string $attribute ) : mixed
$attribute string
return mixed

parameterize() public method

Generate DataTables js parameters.
public parameterize ( array $attributes = [] ) : string
$attributes array
return string

parameters() public method

Configure DataTable's parameters.
public parameters ( array $attributes = [] )
$attributes array

scripts() public method

Generate DataTable javascript.
public scripts ( null $script = null, array $attributes = ['type' => 'text/javascript'] ) : string
$script null
$attributes array
return string

setTableAttribute() public method

Sets HTML table attribute(s).
public setTableAttribute ( string | array $attribute, mixed $value = null )
$attribute string | array
$value mixed

setTableAttributes() public method

Sets multiple HTML table attributes at once.
public setTableAttributes ( array $attributes )
$attributes array

setTemplate() public method

Set custom javascript template.
public setTemplate ( string $template )
$template string

setTitle() public method

Set title attribute of an array if not set.
public setTitle ( string $title, array $attributes ) : array
$title string
$attributes array
return array

table() public method

Generate DataTable's table html.
public table ( array $attributes = [], boolean $drawFooter = false ) : string
$attributes array
$drawFooter boolean
return string

template() protected method

Get javascript template to use.
protected template ( ) : string
return string

Property Details

$ajax protected_oe property

protected string|array $ajax
return string | array

$attributes protected_oe property

protected array $attributes
return array

$collection public_oe property

public Collection,Illuminate\Support $collection
return Illuminate\Support\Collection

$config public_oe property

public Repository,Illuminate\Contracts\Config $config
return Illuminate\Contracts\Config\Repository

$form public_oe property

public FormBuilder,Collective\Html $form
return Collective\Html\FormBuilder

$html public_oe property

public HtmlBuilder,Collective\Html $html
return Collective\Html\HtmlBuilder

$tableAttributes protected_oe property

protected array $tableAttributes
return array

$template protected_oe property

protected string $template
return string

$url public_oe property

public UrlGenerator,Illuminate\Routing $url
return Illuminate\Routing\UrlGenerator

$validCallbacks protected_oe property

Lists of valid DataTables Callbacks.
protected array $validCallbacks
return array

$view public_oe property

public Factory,Illuminate\Contracts\View $view
return Illuminate\Contracts\View\Factory