I’m developing site which has CGridView tables with colorful column Status.
One of columns is custom, it is status column and each field need to have color. I’ve already create css classes with settings for bg color for table fields. On AfterAjaxUpdate I use simple js function, which add class to field depends on field value. But this column is not sortable. I need to make it sortable. Can you please explain how can I make it or where find solution?
How to make sortable custom columns?
What is the right way to colorize fields in CGridView?
you should post your code… how did u make ur column color…
then only others can propose different method
i search some like you, but only color - find in stackoverflow -> yii-cgridview-add-own-attribute
Use in code ‘cssClassExpression’ => ‘($data[“rate”] > 70) ? “color-orange” : “color-green”’,
You said that you were using a custom column: Did you make it or is it an extension? What does it extend from? Is the attribute from a related table?
You can also search for information on sorting/filtering a field from a related field. It involves a new public filed in the model (used in the filter column), setting how to ‘sort’ in the DbCriteria.