Yii2: Ajax Gridview

Want to navigate through the grids or trying to sort and filter data without waiting for the entire page to load? You need yii\widgets\Pjax and wrap it around GridView.

Yii2: Typeahead widget

In Yii V1, you use CJuiAutoComplete widget which displays an autocomplete field. There’s equivalent widget in Yii2 but I’ve not tried it yet because I tried something developed by external parties before I knew it exists. I’ve had successful use with the Typeahead widget, which is a wrapper class for Twitter Typeahead jQuery plugin.

Yii2: Export GridView

Export is not available from the built-in GridView widget. However there’s an enhanced GridView widget that include this functionality, along with many other features missing from the built in widget.

Yii: CSS file order with registerCssFile

In Yii there are different ways to include stylesheet. It can be done by inserting HTML code into header page, as shown in default layout files (eg yii/protected/views/layouts/main.php). it can also be done by calling registerCssFile(). I’ve been using the HTML code method because that’s the default when setting up an Yii project. Recently I wanted to…

Continue Reading »