Yii:: Reset Filter on GridView

Yii:: Reset Filter on GridView

1. Add this reset button:

<?php echo CHtml::resetButton('Clear!', array('id'=>'form-reset-button')); ?>

2. Add this jquery:

$('#form-reset-button').click(function()
{
   var id='document-grid';
   var inputSelector='#'+id+' .filters input, '+'#'+id+' .filters select';
   $(inputSelector).each( function(i,o) {
        $(o).val('');
   });
   var data=$.param($(inputSelector));
   $.fn.yiiGridView.update(id, {data: data});
   return false;
});

This code copy from Yii Forums. Credit to Maurizio Domba.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s