Wiki

Articles tagged with "cgridview"X
Displaying 1-10 of 38 result(s).

CGridView: Adding behaviors from configuration, and template items from behaviors to CGridView

Created about a month ago by le_topTips0 comments – viewed 2,261 times – ( +3 )
Changing the way a CGridView is rendered from the configuration file, or through behaviors specified at the moment it is used, is handy to extend a CGridView without creating tons of different classes for it. I am surprised that this is not in the default implementation, so I made my default CGridView implementation.

Adding a date range search for CGridView the easy way

Created 2 months ago by mikewalenTips2 comments – viewed 3,578 times – ( +5 )
After a lot of research, everything I found on adding date range searching to a CGridView advanced search form seemed to involve adding two new public variables (e.g. $date_from, $date_to), 'safe' rules for the new variables, and a rather chunky if/elseif/else check in the search() method. This probably isn't a hassle for most, but because many of the tables in my database contain two or three and sometimes four date columns (e.g. date_created, date_modified, date_deleted etc.), it meant I was having to add up to eight public variables, the corresponding safe rules, and modifying the search() criteria for each date attribute. So, I set about creating a better way and I thought I'd share my work with the community.

Adding a link to a CDataColumn

Created 2 months ago by le_topTips3 comments – viewed 2,621 times – ( +2 )
Backoffice Grid Views often list information like Posts for a blog while showing at the same time linked information like the User who wrote that post. For more efficiency, it is appropriate that the User is displayed as a link to the User detail page.

Limit a CGridView field to some preset length.

Created 2 months ago by le_topHow-tos1 comment – viewed 2,242 times – ( +8 )
Sometimes text inside a gridview column is just too long. That's why I figured out a way to make the column smaller while still providing the information.

Adding 'disabled' to CCheckBoxColumn and support for yiigridview.js

Created 6 months ago by Xgamer99Tips3 comments – viewed 3,963 times – ( +1 )
I recently had to have a checkbox column in my grid view that supported the 'disabled' attribute. This was easy enough to do by extending the CCheckBoxColumn. However, I also wanted the checkbox to be selected when clicking on the table's row (supported via CGridView's selectableRows option). I discovered I had to tweak yiigridview.js so that it would not select disabled rows when clicking on it or on the 'select all' checkbox.

Create custom button button with AJAX function in CGridView

Created 6 months ago by nkdHow-tos0 comments – viewed 9,412 times – ( +4 )
CButtonColumn in CGridView can be customised to include user built buttons. To learn a great deal about including custom buttons, read this excellent wiki. This tutorial will show how to call an action from one custom button using AJAX instead of regular GET calls.

Displaying, sorting and filtering HasMany & ManyMany relations in CGridView

Created 8 months ago by yJeroenTutorials8 comments – viewed 16,208 times – ( +11 )
This tutorial gives you multiple options of how to fully implement showing, sorting and filtering related data in gridviews.

CGridView, CListView and CActiveDataProvider

Created 8 months ago by softarkTutorials11 comments – viewed 31,753 times – ( +27 )
CGridView (or CListView) together with CActiveDataProvider is a very powerful combination of the built-in tools of Yii. But how do they work together to accomplish their fantastic functions? And what are you expected to do to use them and to customize their behaviors? This article explains the very basics of them.

CButtonColumn: Use special variable $data for the 'id' in the 'options' of a button

Created 8 months ago by bluezedTutorials5 comments – viewed 6,924 times – ( +6 )
In an application I had a CGridView with a CButtonColumn and for an Ajax-Request I needed to make sure that the IDs of the buttons would not change when the GridView was updated so in effect I wanted to link them to the $data->id. So I tried:

Customize CGridView columns directly in your view

Created 9 months ago by clapasTips2 comments – viewed 9,354 times – ( +2 / -1 )
You usually take a model instance passed into your view to provide data to a CGridView in this way: