It handles the initialization of a jquery plugin that creates floating headers. It implements the dosamigos\grid\contracts\RegistersClientScriptInterface so the grid knows it has to call the registerClientScript() method of the behavior.

The jquery plugin is the great jQuery.floatThead plugin. so to be able to work with GridView tables. Check the plugin options for further information regarding the configuration options and events of the plugin.

Note This behavior cannot be used with ResizableColumnsBehavior as it requires the headers to be on fixed width.


Simply attach it to the GridView widget like this:

use dosamigos\grid\GridView;
use yii\web\JsExpression;

echo GridView::widget(
        'behaviors' => [
                'class' => '\dosamigos\grid\behaviors\FloatHeaderBehavior',
                'clientOptions' => [ // ... plugin options
                    'floatContainerClass' => 'white',
                    'top' => 50
                'clientEvents' => [
                    'floatThead' => new JsExpression("function(e, isFloated, $container){ console.log('...'); }");
        // ... other settings 

© 2amigos 2013-2017