CGridView + filters + ajax... going mad

Hi all!!

I’m losing hope… I can’t catch a few points… I searched through topics but none was enough complete or clear (to me) to understand how to accomplish my goal.

I have a create form for AR class ‘Activity’… inside this very form I have to “link” another AR class (‘Teacher’) by making the user choice from a CGridView list. So far no problem…

What I can’t figure out is how to filter this CGridView, in realtime, using some of the field of the same form…


Form 'create' for 'Activity'

  field 'code'

  field 'description'


  field 'service_type'            (<-- necessary field to narrow down list of teachers)

  field 'date_from'               (<-- optional field to narrow down list of teachers)

  field 'date_to'                 (<-- optional field to narrow down list of teachers)

  listbox of choosen teachers     (<-- where id of choosen teacher go)

  cgridview (with checkboxes)     (<-- to update using prev filters)



‘service_type’ it’s an external id

‘date_from’ and ‘date_to’ should be used to search through teachers’ calendar for free time

I can’t understand where I should put the code that make the query with parameters (filters) and how to bring back result into CGridView.

Thanks in advance

You area bit 'ubusing" of CGridView, anyway I can advice you to use the same code of the action admin for filter the cridview, in theory it should work.

Anyway I have never used a CGridView as an imput field, I am not sure if is even possible to achive such a goal.

A simple CheckBoxList would be too long?

Since there is the option to put checkbox in front of every line I suppose it’s possibile… I’ll give a try…

I wanted to give pagination, sorting and filter (ones on column) capabilities to this list.


…aborted… too messy… :-[