Reseting Cgridview

I have a CGridview with a search form above it. As part of the search form there is a clear button which should bring back all the results. At the moment it keeps the search fields although they clear from the inputs.

The code for the clear is:


<div class="clearOptions">

                <a href="javascript:clearForm();">Clear options</a>

            </div>

and


Yii::app()->clientScript->registerScript('clearForm', "

function clearForm() {

    $(':input','#searchOptions').not(':button, :submit, :reset, :hidden').val('').removeAttr('checked').removeAttr('selected');

    $.fn.yiiGridView.update('product-grid', {

            data: ''

    });

}

", CClientScript::POS_HEAD);

What am I missing?

Is your grid cleared?

The values on the form clear but the params do not change.

Below is the parameters that are passed after the form is cleared and the CGridview is updated

4456

CGridView-clearForm.PNG

Any ideas how I can clear these parameters?

Thank you

I have found the answer:

Instead of updating the CGridview, submit the form which processes the data and then updates CGridview.