Wiki

Articles tagged with "cgridview", sorted by commentsX
Displaying 31-40 of 62 result(s).

Saving CGridView filter

Created 8 months ago by sefburhanTutorials5 comments – viewed 4,228 times – ( +27 ) – version 1.1
In this tutorial we will try to save cgridview filter(search) with title etc. basically we want to save two forms data i.e one represents filters and other data about filters like title, description etc. You can define your own structure for filter saving table here are some basic steps

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

Created 2 years ago by bluezedTutorials5 comments – viewed 19,984 times – ( +10 / -1 ) – version 1.1
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 2 years ago by clapasTips4 comments – viewed 21,134 times – ( +3 / -2 ) – version 1.1
You usually take a model instance passed into your view to provide data to a CGridView in this way:

Using standard filters in CGridView custom fields

Created 3 years ago by GOshaHow-tos4 comments – viewed 50,414 times – ( +17 ) – version 1.1
In this article I'll try to explain how to use standard quick search fields in CGridView with customized columns.For example: We have a record in a database with field switch having 0 or 1 values. After that we want a user to see on or off instead 1 or 0. So we do the usual thing:

Keeping a running total in a CGridView

Created 3 years ago by Steve FriedlHow-tos4 comments – viewed 22,735 times – ( +24 ) – version 1.1
This tip created in conjunction with IRC #yii channel users emilsedgh and tydeas - thanks!
tags: CGridView

Adding a date range search for CGridView the easy way

Created about a year ago by mikewalenTips4 comments – viewed 17,101 times – ( +12 ) – version 1.1
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.

CGridView: Use special variable $data in the htmlOptions of a column (i.e. evaluate htmlOptions attribute)

Created 2 years ago by c@cbaTutorials3 comments – viewed 39,563 times – ( +28 / -1 ) – version 1.1
    For each column of the CGridView, we can specify name, value, htmlOptions, cssClassExpression etc. In the declarations of the attributes value and cssClassExpression we can use the "special" variable $data, for example like this: 'value'=>'$data->author->username',.     Now we might want to use $data in the declaration of the htmlOptions attribute, which is normally not possible, to generate for example the tag <td id="3" class="name_3">, where 3 is the id of the data model for the current row, i.e. $data->id. That is, we want to be able to use: 'htmlOptions'=>array('id'=>'$data->id', 'class'=>'"name_{$data->id}"')     Here's a way to accomplish this...

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

Created about a year ago by Xgamer99Tips3 comments – viewed 9,396 times – ( +1 ) – version 1.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.

Update specific cgridview html row after AJAX request

Created 5 months ago by KonApazHow-tos3 comments – viewed 4,498 times – ( +2 ) – version 1.1
After of model update (successfull or not) throught CGridView (check the below link) you probably need to updates the specific row html in cgridview (not entire cgridview)

Insert a multirow header in CGridView

Created about a year ago by PeppeHow-tos2 comments – viewed 9,179 times – ( +5 ) – version 1.1
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 headers, and obtain a nicer view.