Yii Framework Forum: Critical problem in IE 8 with CGridView - Yii Framework Forum

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Critical problem in IE 8 with CGridView Rate Topic: ***** 2 Votes

#21 User is offline   Mohsen Najaflou 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 23-August 11
  • Location:Zanjan, Iran

Posted 14 September 2011 - 02:32 AM

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.
0

#22 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,358
  • Joined: 12-October 09
  • Location:Croatia

Posted 14 September 2011 - 03:07 AM

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...
Find more about me.... btw. Do you know your WAN IP?
0

#23 User is offline   Mohsen Najaflou 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 23-August 11
  • Location:Zanjan, Iran

Posted 14 September 2011 - 03:42 AM

View Postmdomba, on 14 September 2011 - 03:07 AM, said:

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

#24 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,358
  • Joined: 12-October 09
  • Location:Croatia

Posted 14 September 2011 - 03:55 AM

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...
Find more about me.... btw. Do you know your WAN IP?
0

#25 User is offline   glyph 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 20-April 12
  • Location:Michigan, USA

Posted 21 March 2013 - 12:47 PM

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>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</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.
-------------------------------------------------
Glyph Imaging and Data Services
0

#26 User is offline   Karl Zilles 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 07-June 11
  • Location:Los Angeles, United States

Posted 21 March 2013 - 01:21 PM

View Postglyph, on 21 March 2013 - 12:47 PM, said:

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.



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) {

0

#27 User is offline   glyph 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 20-April 12
  • Location:Michigan, USA

Posted 21 March 2013 - 04:35 PM

View PostKarl Zilles, on 21 March 2013 - 01:21 PM, said:

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).

-- snip --




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.
-------------------------------------------------
Glyph Imaging and Data Services
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users