Showing 21-40 of 65 items.

Insert a multirow header in CGridView

Created 13 years ago by Peppe Peppe, updated 11 years ago by Peppe Peppe. 2 comments

The CGridView widget is very useful and customizable, but sometimes you need a little more. One limit I found is to have only one row for headers; yes, you can write each column header in more than one row, but just inside the single cell. I was looking instead for the possibility to use more than one row, with different structure one from the others. This way **you can write columns grouping h...

4 0
5
Viewed: 31 164 times
Version: 1.1
Category: How-tos

CGridView. Add custom class to table rows preserving original „odd“ and „even“

Created 13 years ago by Maug Lee Maug Lee, updated 12 years ago by yugene yugene. 2 comments

Lets say we have such a CGridView widget showing a list of users for administrator. Users have status „active“ or „disabled“. Grid widget puts class „odd“ or „even“ to rows and we want to preserve this. So we want to add a class „disabled“ to rows with disabled users.

Implementation

<?php
$this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'user-grid',
	'dat...
7 0
4
Viewed: 59 234 times
Version: 1.1
Category: How-tos

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

Created 13 years ago by le_top le_top, updated 13 years ago by le_top le_top. 0 comments

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.

3 0
3
Viewed: 18 373 times
Version: 1.1
Category: Tips

Adding a date range search for CGridView the easy way

Created 13 years ago by mikewalen mikewalen, updated 12 years ago by mikewalen mikewalen. 6 comments
  1. Create an Active Record Behavior that builds the criteria for the search() method and attach it to your model
  2. Modify the search() method of the model to merge the behavior's criteria in with the rest of the searchable attributes
  3. Modify the _search form view to add the date range inputs
6 0
11
Viewed: 46 170 times
Version: 1.1
Category: Tips

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

Created 13 years ago by Xgamer99 Xgamer99, updated 13 years ago by Maurizio Domba Cerin Maurizio Domba Cerin. 3 comments

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 o...

1 0
7
Viewed: 25 047 times
Version: 1.1
Category: Tips

CGridView, CListView and CActiveDataProvider

Created 13 years ago by softark softark, updated 13 years ago by softark softark. 22 comments

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.

26 0
33
Viewed: 151 670 times
Version: 1.1
Category: Tutorials