A
A
Alexander Dupliy2014-06-16 16:23:22
Yii
Alexander Dupliy, 2014-06-16 16:23:22

How to filter results in CGridView not only by pressing enter?

Good afternoon! Problem following: Is with the data + filters. The date filter works through the YiiBooster widget - TbDateRangePicker. The problem is that the filter should work when a date is selected (by clicking), i.e. I chose the date - "For this week", and the grid should be updated immediately, but now it works only after pressing the enter button.
That is, I chose a value (date), this date is substituted in the field and nothing is filtered until you press enter. There is some 'callback' parameter in the widget output code, I inserted the $.fn.yiiGridView.update() function with the grid id there, and the function works, but does not send the form data, i.e. just makes ajax request without data :). How to be, it’s not clear, I’m very, very new to Yii ... I’m
attaching a filter screen by date, so that it’s roughly clear what I’m talking about:401099ffdd07427fb513dcc7794e3ccd.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2014-06-16
@booomerang

Try this callback
You need to re-initialize the daterangepicker plugin to make it work again. It's
done like this
In the grid settings
And after or before the grid

Yii::app()->clientScript->registerScript(
    'reinstall','
function reinstallDatePickers(id,data){
        $("#Orders_created").daterangepicker({настройки грида}, function(){
            $(this.element).change();
        });
');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question