I have this problem too. I’m using yii-1.1.8.
I searched for browser.mise in jquery.yiigridview.js but i couldn’t find it.
Does anybody know what I should do?
Thanks.
I have this problem too. I’m using yii-1.1.8.
I searched for browser.mise in jquery.yiigridview.js but i couldn’t find it.
Does anybody know what I should do?
Thanks.
Note that you responded to a thread from 2010… and the problem discussed here has been already solved in the core…
Can you explain better your problem…
Tnx for fast reply.
I have problem with CGridView in IE when I’m sorting it or using $(’#gridName’).yiiGridView.update(‘girdName’) function.
The problem is that when I do these, gridview disappears.
What is the problem?
So you use some custom code… this is not related this thread…
Does it work for you the default grid generated with Gii ?
You need to explain better your problem if you want help… and post relevant code…
This problem persists for me in Yii 1.1.10 with Gii-generated CGridView. No extra javascripts are used.
Enter key does not filter in IE 8 or 9. Only tab and click outside field trigger the filter. Current Firefox and Safari work fine.
Search model method
public function search()
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria=new CDbCriteria;
$criteria->compare('id',$this->id,true);
$criteria->compare('name',$this->name,true);
$criteria->compare('description',$this->description,true);
$criteria->compare('prefix',$this->prefix,true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
search controller action:
/**
* Manages all models.
*/
public function actionSearch()
{
$model=new Programs('search');
$model->unsetAttributes(); // clear any default values
if(isset($_GET['Programs']))
$model->attributes=$_GET['Programs'];
$this->render('search',array(
'model'=>$model,
));
}
search.php view
<?php
$this->breadcrumbs=array(
'Programs'=>array('index'),
'Search',
);
include_once(dirname(__FILE__).'/../menu/_menu.php');
Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
$('.search-form').toggle();
return false;
});
$('.search-form form').submit(function(){
$.fn.yiiGridView.update('programs-grid', {
data: $(this).serialize()
});
return false;
});
");
?>
<h1>Search Programs</h1>
<p>
You may optionally enter a comparison operator (<b><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b><></b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>
<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
'model'=>$model,
)); ?>
</div><!-- search-form -->
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'programs-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'id',
'name',
'description',
'prefix',
'library_prefix',
array(
'class'=>'CButtonColumn',
),
),
)); ?>
As you can see this is a vanilla CGridView widget with the exception of me renaming admin to search. Can someone help me out with a workaround for current Yii versions? Not sure where to paste in this js fix code in the previous posts.
Thanks much.
We had this problem too in 1.1.10. I don’t know if this has been fixed in later versions of Yii (They’re on 1.1.13 now). Here is our patch which we’ve been using:
Index: C:/project/goisuzu/framework/zii/widgets/assets/gridview/jquery.yiigridview.js
===================================================================
--- C:/project/goisuzu/framework/zii/widgets/assets/gridview/jquery.yiigridview.js (revision 851)
+++ C:/project/goisuzu/framework/zii/widgets/assets/gridview/jquery.yiigridview.js (revision 852)
@@ -84,14 +84,23 @@
});
}
- $(document).on('change', inputSelector, function () {
+ var update_func = function () {
var data = $(inputSelector).serialize();
if (settings.pageVar !== undefined) {
data += '&' + settings.pageVar + '=1';
}
$('#' + id).yiiGridView('update', {data: data});
+ };
+
+ $(document).on('change', inputSelector, update_func);
+
+ $(document).on('keypress', inputSelector, function (e) {
+ var code = e.keyCode ? e.keyCode : e.which;
+ if (code == 13)
+ update_func();
});
+
if (settings.selectableRows > 0) {
selectCheckedRows(this.id);
$(document).on('click', '#' + id + ' .' + settings.tableClass + ' > tbody > tr', function (e) {
Excellent. That did the trick, I think.
Thanks.
Edit …
After using this fix a bit more, I have noticed it may cause problems when using multiple simultaneous ajax-loaded cGridViews within a single parent view. Will have to do some more testing to be sure. Otherwise it seems ok.