0

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??

2
  • 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). Commented 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 yii Commented Jul 1, 2011 at 15:58

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.