Am I missing something or if using filter as combo box is not working?
I have a column where currently I got ‘WLWD’ for every record. I declared filter for that column to be a combo box, having:
'filter'=>array('test', 'test2', 'test3', 'WLWD'),
Combo box filter is drawn correctly, but whenever I select any of first three options, I see whole set of data while for my reason I should see none - i.e. there is no record in current dataset, which has value in that column equal to test, test1 or test2 respectively. What am I missing?
Problem 2: It seems hard for me to believe that whoever created so wonderfully working GridView hasn’t thought about resetting it directly from search form connected to it and made resetting GridView to inital state easy. Maybe it is worth opening ticket to request such feature?
Yes! You’ve already explained me this. And I’m looking for own piece of code that will do this. I’m only wondering, why code like this:
$.fn.yiiGridView.update('zlecenia-grid', {data: $(this).serialize()});
works fine in submit method - i.e. we don’t have to iterate through all form fields and build set of data being sent to GridView’s update manually? And why the same approach does not work in reset click method, meaning that why serializing there the same object does return an empty set instead of all filters names with empty values? Which is - as you explained - required by GridView to reset itself to an initial state?
Maybe my misunderstanding comes from that right now I’m looking at this problem more like theoretical not coding problem.
I.e. We have a form with fields. Fields has values. When clicking submit we do not iterate all fields, instead we’re just serializing parent object (form?) and all works like a charm. All filters data is properly formatted to an array form and sent to gridview, which properly processes it.
Then we take reset button, we’re doing exactly the same with only difference that before serializing object, we resetting (clearing) all form fields. If we are doing exactly the same, the same result should be received, i.e. we should receive array containing fields name and their values, which are empty in this situation. Instead we are getting empty set and I have no bloody idea, why?
The only reason I may think of - completely wako - is that $(this).serialize() implementation differs between submit and click functions or that $(this) refers to a different object in both cases. Both ideas are hard to believe in.