Search Models are a very elegant and powerful way to build an Active Data Provider. If you use them a lot, you'll quickly need to use scenarios, which will lead you to a very DRY Controller code.
Search Models are a very elegant and powerful way to build an Active Data Provider. If you use them a lot, you'll quickly need to use scenarios, which will lead you to a very DRY Controller code.
This article tries to describe the practical techniques of searching by a HAS_MANY relation using ActiveRecord of Yii 2.0.
Hi Friends, In this tutorial I write a code display dependent drop-down value using ajax call.
Efficient coding with Yii implies efficient use of the code generator. This article shares the personalised Gii templates that were built starting from the standard templates proposed by AweGen.
Yii has a neat "trick" that will assign default values to new CActiveRecords. When performing a search() though, this is pretty annoying as they automatically apply as filter values.
This is a shortcut for adding a text search for multiple values i.e.
Suppose you have an Application in Yii that manages hotels each one has many customers.
Sometimes we get lost trying to search by a HAS_MANY relation using CActiveRecord or CActiveDataProvider in Yii 1.1. This article is a series of drills that try to describe the practical techniques of searching by a HAS_MANY relation.
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.
class Post extends CActiveRecord {
...
}
`
When you list Authors in grid you would like to print the count of posts in column, allow sorting on this column and probably filtering by the count.
This is what I did. Its the EASIEST solution that I know of. I just reused the advanced search done in CGridView.
I ran into a problem and on irc we worked it out. Since there is a lack on information on filters in genral i thought i'd start sharing all my findings, might be usefull for other people.
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:
<?php $this->widget('zii.widgets.grid.CGridView', array(
//.....
array(
'name'=>'...
The official Yii project site now supports OpenSearch. This means you can customize your browser's search box to enable direct search of the content in yiiframework.com. For example, by entering a Yii class name in the browser's search box, the corresponding class API page will be shown in the browser.