Wiki

Articles in category "tips", sorted by ratingX
Displaying 61-70 of 154 result(s).

View a related field in CGridView

Created 3 years ago by rafaelt88Tips1 comment – viewed 11,764 times – ( +6 / -1 ) – version 1.1
Generally we need to show one or more fields from a model that is related to another model used in CGridView. For our case we will use two related models, which explain how to use model "A" fields in a CGridView that used model "B".

Saving files to a blob field in the database

Created 7 years ago by zaccariaTips8 comments – viewed 58,798 times – ( +9 / -3 ) – 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

Yii2 Report Grid

Created 4 months ago by Chris BackhouseTips0 comments – viewed 5,904 times – ( +3 ) – version 2.0
There are some very advanced grids in the Yii2 community, specifically Kartik's amazing gridview extensions but they all designed for interactive screen use.
tags: GridView, report

Boost composer-asset-plugin update speed

Created about a year ago by schmunkTips5 comments – viewed 11,060 times – ( +5 / -1 ) – version 2.0
If you're using a lot of bower and npm assets with Yii 2.0 you might encounter long running composer update tasks.

Extending CActiveForm for some form display fixes and language tweaks

Created 7 years ago by TrejderTips0 comments – viewed 17,450 times – ( +5 / -1 ) – 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.

CGridView customized CCheckBoxColumn

Created 3 years ago by chandranTips2 comments – viewed 13,265 times – ( +5 / -1 ) – version 1.1
Hi friends,

Patching PHP code (used as a library) without changing the original code!

Created 4 years ago by le_topTips0 comments – viewed 7,082 times – ( +5 / -1 ) – version 1.1
The article Fixing extensions without modifying their code reminded me of another patching technique that I used. My conviction and a hard look on the web had led me to an article Redefine PHP class methods or class giving me a head start to do what I wanted: patching third party code without touching the original to allow easy upgrades.
tags: patch, patching

using jqbargraph to create beautiful graphs

Created 4 years ago by MAHESH.E.UTips1 comment – viewed 8,693 times – ( +5 / -1 ) – version 1.1
If you are about to create a graph, the best option i would suggest is the jqbargraph.

CGridView: Adding behaviors from configuration, and template items from behaviors to CGridView

Created 4 years ago by le_topTips0 comments – viewed 10,198 times – ( +5 / -1 ) – version 1.1
Changing the way a CGridView is rendered from the configuration file, or through behaviors specified at the moment it is used, is handy to extend a CGridView without creating tons of different classes for it. I am surprised that this is not in the default implementation, so I made my default CGridView implementation.

Debugging CActiveRecord failed save() attempts

Created 4 years ago by BoazTips0 comments – viewed 23,775 times – ( +5 / -1 ) – version 1.1
When you're filling up a form of a CActiveRecord (using CActiveForm for example), usually you'll construct your code so that in case of validation error you'll get back the form with the error displayed back to you, typically when CActiveForm.errorSummary() is used. This is how its done by Gii.