Wiki

Articles in category "tips", sorted by viewsX
Displaying 41-50 of 141 result(s).

Avoiding duplicate script download when using Ajax calls to render different Views

Created 3 years ago by Antonio RamirezTips6 comments – viewed 18,785 times – ( +13 / -1 ) – version 1.1
I had to partially render two types of views, depending on user selection. Wanted to display a GRID or a LIST style with an event that AJAX'ed new contents and update a layer with them.
tags: tutorial, AJAX, views

Custom column in TbGridView with icon by condition, find out icon class glyphicons easy (YiiBooster)

Created about a year ago by KonApazTips2 comments – viewed 18,280 times – ( +2 / -1 ) – version 1.1
First of all, You have to find out the class of the desired icon, so visit the http://getbootstrap.com/2.3.2/base-css.html#icons

Adding a date range search for CGridView the easy way

Created about a year ago by mikewalenTips4 comments – viewed 18,254 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.

Send asset folder path to a javascript of a widget

Created 3 years ago by sensorarioTips4 comments – viewed 17,191 times – ( +4 ) – version 1.1
When you develop a widget, you could need one image that is in the assets folder, you can use it simply within a css. You can load a css or javascript script doing this:

Using cache in CActiveDataProvider

Created 3 years ago by StammTips7 comments – viewed 15,495 times – ( +20 ) – version 1.1
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.

Yii Security-extended guide

Created 3 years ago by bingjie2680Tips11 comments – viewed 15,422 times – ( +6 / -6 ) – version 1.1
This article is called extended guide is because there is already a security guide in the Yii tutorial security section. but that guide is not complete in the sense that it does not rise the developers' attention to some other commonly happening attacks: SQL injection and magic URL, which can be major vulnerabilities in your application without much caring.

Using jQuery UI 1.8.10 themes with Yii 1.1.6

Created 3 years ago by a110yTips7 comments – viewed 15,202 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:

Rendering Views and Updating them with Ajax

Created about a year ago by Manish GuptaTips4 comments – viewed 14,301 times – ( +2 )
I wanted to implement a widget that could refresh itself through Ajax without refreshing the whole page. CGridView and CListView are excellent examples of such widgets.

Code style

Created 4 years ago by zaccariaTips2 comments – viewed 14,073 times – ( +29 ) – version 1.1
Often, when writing widgets or editing Yii code, it is unclear whether or not the code is following the MVC pattern.
tags: mvc

Extending CActiveForm for some form display fixes and language tweaks

Created 4 years ago by TrejderTips0 comments – viewed 13,519 times – ( +5 ) – version 1.1
In this simple example I'll demonstrate how to extend CActiveForm class to overload some drawing functions to achieve some commonly used fixes in forms.