i am new to yii and i an trying to integrate the jquery plugin datatables into my yii application. Is there any blog or documentation available that shows me how to do this??
-
Yii uses GridView for this purpose, see: yiiframework.com/doc/api/1.1/CGridView . If you are already using DataTables, you need to be more specific in your question as there are many ways to implement it (table, json, xhr, etc).ldg– ldg2011-06-30 20:39:00 +00:00Commented Jun 30, 2011 at 20:39
-
i am trying to implement it as a table first. I guess my question should have been best practises on how to integrate a jquery plugin in yiiuser648929– user6489292011-07-01 15:58:44 +00:00Commented Jul 1, 2011 at 15:58
Add a comment
|
1 Answer
If you are already using Yii's version of jQuery, make sure it's compatible with the version of DataTables you are using. If not, you can use the jQuery CDN version or your own local version with a statement like:
Yii::app()->clientScript
->registerScriptFile('http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js')
->registerScriptFile(Yii::app()->baseUrl . '/path/to/datatables/script/datatables.js');
You can define where in your document it will be included with parameters: CClientScript::POS_HEAD, CClientScript::POS_BEGIN, CClientScript::POS_END See: http://www.yiiframework.com/doc/api/1.1/CClientScript#registerScriptFile-detail