Wiki

Articles in category "tips", sorted by commentsX
Displaying 11-20 of 123 result(s).

Update two models with one view

Created 2 years ago by sensorarioTips10 comments – viewed 27,968 times – ( +10 / -2 ) – version 1.1
Suppose to have two models: Users and Emails. You do not want to store email in a Users model. And User can have 0 or many emails. This is the form generated to create a new user (just username).
tags: database, model, view, form

An Easy Solution for Dependent dropDownList Using AJAX

Created about a year ago by mrsTips10 comments – viewed 40,094 times – ( +11 / -1 ) – version 1.1
Sometimes new Yii guys face problem to manage dependent dropDownList using AJAX. I am going to discuss an easy solution about this issue.

Special $variables in CGridView and CListView

Created 2 years ago by Steve FriedlTips10 comments – viewed 37,238 times – ( +23 / -1 ) – version 1.1
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.

A simple action for CJuiAutoComplete

Created 3 years ago by tydeas_drTips9 comments – viewed 25,197 times – ( +16 / -1 ) – version 1.1
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?

Using counters with ActiveRecord

Created 2 years ago by davi_alexandreTips8 comments – viewed 16,928 times – ( +14 / -1 ) – version 1.1
Let's say, for example, that you are developing a blog or some kind of CMS and you want to track the number of times each post was viewed (maybe to show a list of the most viewed ones).

An easy way to use escopes and CActiveDataProvider

Created 3 years ago by Rafael GarciaTips8 comments – viewed 19,097 times – ( +1 / -1 ) – version 1.1
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.

Using CJuiDialog to edit rows in a CGridView

Created 2 years ago by Russell EnglandTips8 comments – viewed 25,169 times – ( +4 / -1 ) – version 1.1
I have a CGridView with a list of clients/events. For each row (EventClient) I wanted a quick edit dialog.

CGridView: Display the full record (actionView) in a CJuiDialog

Created 2 years ago by JobloTips7 comments – viewed 31,268 times – ( +15 ) – version 1.1
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.

Saving files to a blob field in the database

Created 3 years ago by zaccariaTips7 comments – viewed 36,847 times – ( +6 / -2 ) – version 1.1
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.
tags: File upload

Using jQuery UI 1.8.10 themes with Yii 1.1.6

Created 3 years ago by a110yTips7 comments – viewed 14,209 times – ( +2 ) – version 1.1
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: