Open onesource4u opened 10 years ago
It doesnt work for me even with fixed header option commented out or set to false. Here is my code, pls correct me if i am doing a thing wrongly. Thanks
$this->widget('bootstrap.widgets.TbExtendedGridView', array(
'cssFile' => $this->assetsPath . '/css/bootstrap.css',
//'fixedHeader' => false,
//'headerOffset' => 40, // 40px is the height of the main navigation at bootstrap
'filter'=>$model,
'type' => 'striped bordered hover myGridView',
'dataProvider' => $model->search(),
'responsiveTable' => true,
'template' => "{items}",
'columns' => array(
array(
'class'=>'CCheckBoxColumn',
'selectableRows' => 2,
'value' => '$data->id',
'checkBoxHtmlOptions' => array('name'=>'Plan[cid][]'),
),
'id',
'plan_name',
'amount',
'status',
array(
'htmlOptions' => array('nowrap'=>'nowrap'),
'class'=>'bootstrap.widgets.TbButtonColumn',
),
),
)
);
hi nothing wrong with your code, are you sure you are catching the params sent and filtering the result based on it?
current version 4.0.1 have this problem.fixed header false work and true not work.
It can be fixed by these steps:
base.$clonedHeader = base.$originalHeader.clone();
(my line 51) var filters = base.$clonedHeader.find(".filters input");
if(filters.length > 0)
filters.removeAttr("name");
You are done. It causes, that cloned header will not have input attribute "name". So when JS serialize() is called, inputs without attribute "name" are ignored.
Can this fix be added to next release? Changing YiiBooster code is not the best option while using Composer to get YiiBooster and other dependencies on multiple systems including production. Since jquery.stickytableheaders.js is registered as an individual js asset (instead of a package), it cannot be overridden either.
thanks
Since jquery.stickytableheaders.js is maintained in another party, so I guess it will be better to add code in TbExtendedGridView.php
idea: jquery select the clone table and remove the name attribute (see DAMI-Mike solution)
line: 692
$fixedHeaderJs = "$('#{$this->id} table.items').stickyTableHeaders({fixedOffset:{$this->headerOffset}});";`
after this line add:
$fixedHeaderJs .= "var filters = $('#{$this->id} table.items .tableFloatingHeader').find('.filters input');
if(filters.length > 0)
filters.removeAttr('name');";
$this->componentsAfterAjaxUpdate[] = $fixedHeaderJs;
thanks to DAMI-Mike
can someone put this in the next release?
@d3artagnan I ended up doing the same from my page level javascript.
Ideally, jquery.stickytableheaders.js should be configured as a package in YiiBooster, similar to many other libraries included. This will allow the YiiBooster users to substitute the plugin file from application level.
The Solution postet from @DAMI-Mike works for most kind of Input, but if you have a Dropdown it will not work. Use this for Dropdown and Textfields:
var filters = base.$clonedHeader.find(".filters input, .filters select");
if(filters.length > 0)
filters.removeAttr("name");
When fixedHeader is set to true for TbExtendedGridView the filter will not work on any columns.
Found this issue in my personal project. Same issue is also on the current Yii Booster TbExtendedGridView page: http://yiibooster.clevertech.biz/extendedGridView/index.html