Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
5dbf6c94
Commit
5dbf6c94
authored
Apr 11, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some docs on GridView
parent
fbc7695a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
data-widgets.md
docs/guide/data-widgets.md
+42
-0
No files found.
docs/guide/data-widgets.md
View file @
5dbf6c94
Data widgets
============
GridView
--------
The
[
[yii\grid\GridView
]
] widget is a powerful tool to create a data grid that provides pagination, sorting
and filtering of the data out of the box.
The GridView gets its data from a
[
data provider
](
data-providers.md
)
which is responsible for sorting and
pagination.
The following code shows a basic example of a gridview showing Users from the database(
`User`
is an
[
active record
](
active-record.md
)
):
In the controller action:
```
php
$dataProvider
=
new
ActiveDataProvider
([
'query'
=>
User
::
find
()]);
return
$this
->
render
(
'myview'
,
[
'dataProvider'
=>
$dataProvider
]);
```
In the view
`myview.php`
:
```
php
echo
GridView
::
widget
([
'dataProvider'
=>
$dataProvider
,
'columns'
=>
[
'id'
,
'name'
,
'email'
,
'last_login_date:datetime'
,
[
'class'
=>
'yii\grid\ActionColumn'
,
]
],
]);
?>
```
### Filtering
TDB
### Filtering by related columns
TDB
ListView
--------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment