Grid
class Grid
Traits
Layui 的参数定义
Trait HasQuickSearch.
Properties
protected string | $name | Grid name. |
from HasElementNames |
protected array | $elementNames | HTML element names. |
from HasElementNames |
protected string | $exporter | Export driver. |
from HasExport |
protected Filter | $filter | from HasFilter | |
static string | $searchKey | from HasQuickSearch | |
protected array|string|Closure | $search | from HasQuickSearch | |
protected Collection | $columns | Collection of all grid columns. |
|
Tools | $tools | from HasQuickSearch | |
protected array | $totalRowColumns | from HasTotalRow | |
protected Closure | $actionsCallback | Callback for grid actions. |
from HasActions |
protected string | $actionsClass | Actions column display class. |
from HasActions |
protected array | $batchActions | from HasActions | |
protected | $batchOperations | from HasActions | |
protected Selector | $selector | from HasSelector | |
$hiddenColumns | Default columns be hidden. |
from CanHidesColumns | |
protected array | $layElem | from LayDefines | |
protected | $layCols | from LayDefines | |
protected int | $layCellMinWidth | 全局定义常规单元格的最小宽度,layui 2.2.1 新增 |
from LayDefines |
protected | $layPage | from LayDefines | |
protected array | $quickButtons | 快捷操作 | from HasQuickButton |
protected | $operations | from HasQuickButton | |
static protected | $initCallbacks | Initialization closure array. |
|
array | $columnNames | All column names of the grid. |
|
array | $perPages | Per-page options. |
|
int | $perPage | 默认分页数 | |
string | $tableId | ||
protected LengthAwarePaginator | $paginator | ||
protected Model | $model | The grid data model instance. |
|
protected Collection | $rows | Collection of all data rows. |
|
protected Closure | $rowsCallback | Rows callable function. |
|
protected Closure | $builder | Grid builder. |
|
protected bool | $isBuild | Mark if the grid is built. |
|
protected array | $variables | All variables in grid view. |
|
protected string | $keyName | Default primary key name. |
|
protected string | $view | View for grid to render. |
|
protected | $renderingCallbacks | ||
protected array | $options | Options for grid. |
Methods
Add where like binding to model query.
Add where date time function binding to model query.
Add where in binding to the model query.
Add where between binding to the model query.
Add where basic binding to the model query.
Dynamically add columns to the grid view.
Add a relation column to grid.
Add a json type column to grid.
Handle get mutator column for grid.
Handle relation column for grid.
Remove column selector on grid.
Setting default shown columns on grid.
Get or set option for grid.
Get primary key name of model.
Paginate the grid.
Get the grid paginator.
设置分页的可选条目数
Disable row selector.
Build the grid.
Get current resource url.
Set a view to render.
Get the string contents of the grid view.
No description
Initialize.
Call the initialization closure array in sequence.
添加多选框列
Apply column filter to grid query.
Apply column search to grid query.
No description
添加多选 / 操作项目
Build the grid rows.
Get all variables will be used in grid view.
Call callbacks before render.
Details
in
HasElementNames at line 33
string
getName()
Get name of grid.
in
HasElementNames at line 45
$this
setName(string $name)
Set name to grid.
in
HasElementNames at line 59
string
getGridRowName()
No description
in
HasElementNames at line 67
string
getSelectAllName()
No description
in
HasElementNames at line 75
string
getPerPageName()
No description
in
HasElementNames at line 83
string
getGridBatchName()
No description
in
HasElementNames at line 91
string
getExportSelectedName()
No description
in
HasElementNames at line 99
string
getSelectedRowsName()
No description
in
HasElementNames at line 113
protected string
elementNameWithPrefix($name)
No description
in
HasExport at line 25
bool
isShowExporter()
是否显示导出按钮
in
HasExport at line 46
string
renderExportButton()
Render export button.
in
HasExport at line 74
string
getExportUrl(int $scope = 1, null $args = null)
Get the export url.
in
HasExport at line 90
protected
handleExportRequest(bool $forceExport = false)
Handle export request.
in
HasExport at line 113
protected AbstractExporter
getExporter(string $scope)
No description
in
HasFilter at line 37
array|Collection|mixed
applyFilter(bool $toArray = true)
执行查询器
in
HasFilter at line 57
Factory|View|string
renderFilter()
Render the grid filter.
in
HasFilter at line 67
protected $this
initFilter()
初始化筛选
in
HasQuickSearch at line 37
QuickSearch
quickSearch($search = null)
No description
in
HasQuickSearch at line 56
protected mixed|void
applyQuickSearch()
Apply the search query to the query.
in
HasQuickSearch at line 85
protected
addWhereBindings(string $query)
Add where bindings.
in
HasQuickSearch at line 129
protected array
parseQueryBindings(array $queries)
Parse quick query bindings.
in
HasQuickSearch at line 167
protected
addWhereLikeBinding(string $column, bool $or, string $pattern)
Add where like binding to model query.
in
HasQuickSearch at line 185
protected
addWhereDatetimeBinding(string $column, bool $or, string $function, string $value)
Add where date time function binding to model query.
in
HasQuickSearch at line 200
protected
addWhereInBinding(string $column, bool $or, bool $not, string $values)
Add where in binding to the model query.
in
HasQuickSearch at line 225
protected
addWhereBetweenBinding(string $column, bool $or, string $start, string $end)
Add where between binding to the model query.
in
HasQuickSearch at line 240
protected
addWhereBasicBinding(string $column, bool $or, string $operator, string $value)
Add where basic binding to the model query.
in
HasTools at line 23
bool
isShowTools()
是否显示导出按钮
in
HasTools at line 57
string
renderHeaderTools()
Render custom tools.
in
HasTotalRow at line 23
$this
addTotalRow(string $column, Closure $callback)
No description
in
HasTotalRow at line 33
Factory|View|string
renderTotalRow($columns = null)
No description
in
HasActions at line 43
$this
actions(Closure|string $actions)
Set grid action callback.
in
HasActions at line 57
string
getActionClass()
Get action display class.
in
HasActions at line 71
$this
setActionClass(string $actionClass)
No description
in
HasActions at line 86
HasActions
batchActions($buttons)
Set grid batch-action callback.
in
HasActions at line 110
Grid|mixed
disableBatchActions(bool $disable = true)
No description
in
HasActions at line 123
string
renderBatchActions()
Render create button for grid.
in
HasActions at line 142
string
skeletonBatchActions()
Render create button for grid.
in
HasSelector at line 22
$this
selector(Closure $closure)
No description
in
HasSelector at line 37
Factory|View
renderSelector()
Render grid selector.
in
HasSelector at line 47
protected $this
applySelectorQuery()
Apply selector query to grid model query.
in
HasColumns at line 36
Column
column(string $name, string $label = '')
Add a column to Grid.
in
HasColumns at line 57
Column
__call(string $method, array $parameters)
Dynamically add columns to the grid view.
in
HasColumns at line 83
Collection
getColumns()
No description
in
HasColumns at line 90
protected
applyColumnOrderBy()
No description
in
HasColumns at line 108
protected Column
addRelationColumn(string $name, string $label = '')
Add a relation column to grid.
in
HasColumns at line 134
protected Column
addJsonColumn(string $name, string $label = '')
Add a json type column to grid.
in
HasColumns at line 151
protected Column
prependColumn(string $name = '', string $label = '')
Prepend column to grid.
in
HasColumns at line 169
protected Column
addColumn(string $name = '', string $label = '')
Add column to grid.
in
HasColumns at line 187
protected bool|Column
handleGetMutatorColumn(string $method, string $label)
Handle get mutator column for grid.
in
HasColumns at line 204
protected bool|Column
handleRelationColumn(string $method, string $label)
Handle relation column for grid.
in
CanHidesColumns at line 25
bool
disableColumnSelector(bool $disable = true)
Remove column selector on grid.
in
CanHidesColumns at line 33
bool
showColumnSelector()
No description
in
CanHidesColumns at line 45
CanHidesColumns
hideColumns(array|string $columns)
Setting default shown columns on grid.
in
CanHidesColumns at line 64
Collection
visibleColumns()
Get all visible column instances.
in
CanHidesColumns at line 84
array
visibleColumnNames()
Get all visible column names.
in
CanHidesColumns at line 104
array
getDefaultVisibleColumnNames()
Get default visible column names.
in
CanHidesColumns at line 120
protected array
getVisibleColumnsFromQuery()
Get visible columns from request query.
in
PoppyTrait at line 43
protected AuthManager
pyAuth()
get auth
in
PoppyTrait at line 52
protected Translator
pyTranslator()
get translator
in
PoppyTrait at line 62
protected Repository
pyConfig()
Get configuration instance.
in
PoppyTrait at line 72
protected DatabaseManager
pyDb()
get db
in
PoppyTrait at line 81
protected Kernel
pyConsole()
Get console instance.
in
PoppyTrait at line 90
protected Container
pyContainer()
Get IoC Container.
in
PoppyTrait at line 99
protected Mailer
pyMailer()
Get mailer instance.
in
PoppyTrait at line 108
protected SessionManager|Store
pySession()
Get session instance.
in
PoppyTrait at line 117
protected Request
pyRequest()
get request
in
PoppyTrait at line 127
protected Redirector
pyRedirector()
get redirector
in
PoppyTrait at line 136
protected Factory
pyValidation()
get validation
in
PoppyTrait at line 146
protected Dispatcher
pyEvent()
get event
in
PoppyTrait at line 156
protected LoggerInterface
pyLogger()
get logger
in
PoppyTrait at line 166
protected ResponseFactory
pyResponse()
get response
in
PoppyTrait at line 176
protected Filesystem
pyFile()
get file
in
PoppyTrait at line 186
protected UrlGenerator
pyUrl()
get url
in
PoppyTrait at line 197
protected mixed
pyCache(string $tag = '')
get cache
in
PoppyTrait at line 211
protected RedisManager
pyRedis()
get redis
in
PoppyTrait at line 220
protected Factory
pyView()
get view
in
PoppyTrait at line 229
protected Poppy
pyPoppy()
get poppy
in
PoppyTrait at line 238
protected Ini
pyIni()
Ini Parser
in
PoppyTrait at line 247
protected Xml
pyXml()
Ini Parser
in
PoppyTrait at line 256
protected Yaml
pyYaml()
Yaml Parser
in
LayDefines at line 35
protected
layPrependRowSelectorColumn()
增加行选择器
in
LayDefines at line 44
protected
layFormat()
Layui 格式化
in
LayDefines at line 54
protected
layColumns()
列样式
in
LayDefines at line 67
protected string
layDefine()
定义 Layui 的数据定义
in
HasQuickButton at line 22
bool
isShowQuickButton()
是否显示导出按钮
in
HasQuickButton at line 33
HasQuickButton
disableQuickButton(bool $disable = true)
Disable export.
in
HasQuickButton at line 44
array
appendQuickButton(array|Closure $buttons)
Get create url.
in
HasQuickButton at line 68
string
renderQuickButton()
Render create button for grid.
at line 171
__construct(Model $model, Closure $builder = null)
Create a new grid instance.
at line 189
static
init(Closure $callback = null)
Initialize with user pre-defined default disables and exporter, etc.
at line 199
Model
model()
Get Grid model.
at line 211
Grid
setLists(string $grid_class, string $field = '', string $order = 'desc')
No description
at line 262
$this|mixed
option(string $key, mixed $value = null)
Get or set option for grid.
at line 278
string
getKeyName()
Get primary key name of model.
at line 290
void
paginate(int $perPage = 15)
Paginate the grid.
at line 302
mixed
paginator()
Get the grid paginator.
at line 317
perPages(array $perPages)
设置分页的可选条目数
at line 328
Grid
disableRowSelector(bool $disable = true)
Disable row selector.
at line 338
void
build()
Build the grid.
at line 354
rows(Closure $callable = null)
Set grid row callback function.
at line 363
string
resource()
Get current resource url.
at line 375
Grid
with(array $variables = [])
Add variables to grid view.
at line 388
setView(string $view, array $variables = [])
Set a view to render.
at line 402
Grid
setTitle(string $title)
Set grid title.
at line 415
Grid
rendering(callable $callback)
Set rendering callback.
at line 428
string
render()
Get the string contents of the grid view.
at line 451
int
getPerPage()
No description
at line 459
protected void
initialize()
Initialize.
at line 473
protected
callInitCallbacks()
Call the initialization closure array in sequence.
at line 489
protected void
prependRowSelectorColumn()
添加多选框列
at line 503
protected void
applyColumnFilter()
Apply column filter to grid query.
at line 515
protected void
applyColumnSearch()
Apply column search to grid query.
at line 525
protected array|Collection|mixed
applyQuery()
No description
at line 544
protected void
addDefaultColumns()
添加多选 / 操作项目
at line 556
protected void
buildRows(array $data)
Build the grid rows.
at line 572
protected array
variables()
Get all variables will be used in grid view.
at line 590
protected void
callRenderingCallback()
Call callbacks before render.