Hi everybody
I need to filter a CGridView, in typical admin page, through a date field with a range from-to.
I’ve found two useful articles about that, but…
http://www.yiiframework.com/wiki/345/how-to-filter-cgridview-with-from-date-and-to-date-datepicker/
The method descripted in this article runs correctly, but after applied the filter, if I use the grid by going in following pages or changing order of data, the range filter is deactivated. More, I would like to put the filter in the predefined "advanced search" box, but it runs only outside of that.
http://www.yiiframework.com/wiki/461/adding-a-date-range-search-for-cgridview-the-easy-way/
This one seems to be more sofisticated (for me) and I’m not sure to understand the problem. After setting the dates in the CJuiDatePicker, when clicking the confirm button it display an error:
htmlspecialchars() expects parameter 1 to be string, array given
C:\xampp\htdocs\yii\framework\web\helpers\CHtml.php(98)
.....
CBaseController->widget("zii.widgets.grid.CGridView", array...
C:\xampp\htdocs\scadenzario\protected\views\scadenza\admin.php(157)
It seems depending from the "attribute" property of CJuiDatePicker that uses square brackets to define tha range as an array:
'attribute'=>$attribute."[$i]",
If I modify the “attribute” property, setting it with a string representing model variables, the error disappear. But the filter doesn’t run!
Can someone help me? thanks