Search code examples
phpyiicgridview

Yii Cgridview Dynamic Columns


I am looking at customising the yii cgridview. I want to be able to allow users to select which columns they wish to see. Currently I am selecting the exact columns which will be displayed.

I have had a look for information on this but do not seem to be getting very far, maybe I am not looking for the correct terms or their is a specific term for this. Ideally users can click a button and tick the boxes which will be seen. I have seen this implemented on x2crm

http://demo.x2engine.com/index.php/accounts/index

I also like the ability to move the columns around ie resort the order of the columns and the ability to resize the columns when more are added. I realise someone isn't going to come along and do this for me, but certainly if someone could provide me any information or similar requests, it would be greatly appreciated.


Solution

  • After a long gruelling search I have found something that may in fact be the solution to both of my requests. An extension for Yii exists that allow for you to chooser the columns you wish to display with a simple tick box selection, as well as allowing for reordering of columns.

    http://ecolumns.demopage.ru/index.php

    The link above takes you to the demo page for the extension and the link below is the link to the extension download page.

    http://www.yiiframework.com/extension/ecolumns/

    This is by far the easiest way to implement this functionality on your web app.