Often used scopes to define criteria in our models. This is a very useful feature as it ensures that in any part of application applying the criteria defined by the scope when called it.
The popular CListView and CGridView widgets each take a data provider and iterate over each data object produced, calling the user's code to render each row one at a time, and most are familiar with the use of the $data variable to represent the current model object or array.
Created about a year ago by Joblo – Tips – 7 comments – viewed 21,655 times
–
( +13 )
If you show a model (with a lot of attributes) partially in a CGridView, it can be helpful when the user can take a quick look at the full record with all attributes without displaying the view
as a page and afterwards returning back to the gridview.
Created about a year ago by Joblo – Tips – 7 comments – viewed 57,447 times
–
( +55 )
If you have to display a overview of related data in a table,
you can use the CListView, create your view with table/tr/td tags
and implement db-queries in the view to display detaildata of the current (master-)record.
As a follow-up from the How to upload a file using a model wiki entry that explains how to save a file to the filesystem, this article will do the same using a blob field in the database.
Created 2 years ago by a110y – Tips – 7 comments – viewed 12,106 times
–
( +2 )
When using the latest stable jQuery UI themes (1.8.10) with Yii 1.1.6 (which uses 1.8.6) the widgets don't appear (they're invisible but they're there). In order to make them visible you need to change the following line:
More or less I use auto-complete field for a form. CJuiAutoComplete is a yii widget for this purposes.
The common use case is to make an ajax request and retrieve a list from the database. So in this case you have to write a controller action to return you a json encoded list.
What if I had a generic action to do this work for me?
Created about a year ago by Stamm – Tips – 7 comments – viewed 9,136 times
–
( +17 )
First param in CActiveDataProvider could be a string with model name or instance of class. So, you may use CActiveRecord::cache() for cache, but you need set third param to 2, because you should cache 2 queries: counting and get data.
Created 8 months ago by sirin k – Tips – 6 comments – viewed 4,728 times
–
( +2 / -1 )
When we are doing an insert of huge no.of rows into an SQL table ,Normally we will try to write separate insert quries this may lead us to a long duration of execution time and we can increase the speed of executing SQL quries by adding all the rows into a single insert query.