Hi guys, I'm just having trouble working out the syntax on this one, was
wondering if anyone could give me a quick hand - or even show me a better
way of doing it :P

What I'm trying to do is get a spinner to pop up when a FilteringSelect is
retrieving its JSON from the server. As best as I can tell, what you have to
do is attach your call on to the onBegin and onComplete of the fetch method
of the FilteringSelect. This is apparently done by way of passing in
fetchProperties, which are then mixed in before the fetch is called by the
FilteringSelect. So what I'm doing is this:

$this->addElement('FilteringSelect', 'jobs', array(
            'label'        => 'Job:',
            'storeId' => 'jobStore',
            'storeType'=> 'dojo.data.ItemFileReadStore',
            'storeParams' => array( 'url' =>
'/jobs/autocomplete/format/ajax?autocomplete=1&str=*',),
            'fetchProperties' => array( 'onBegin' =>
'snowwhite._toggleAjaxSpinner()', 'onComplete' =>
'snowwhite._toggleAjaxSpinner()' ),
            'autoComplete'   => 'false',
            'hasDownArrow'   => 'true',
            'id' => 'fk_jobs_id',
        ));

It's the fetchProperties format that is getting me. If I just include ONE
value, like this:

'fetchProperties' => array( 'onBegin' => 'snowwhite._toggleAjaxSpinner()' ),

It works fine - it actually triggers off the spinner, so I'm pretty sure I'm
on the right track here. The problem is trying to add in the onComplete, I
just can't seem to work out the syntax for passing through a second
property. I've tried various combinations of arrays inside arrays and all
sorts of tricks, all to no avail. Anyone know what I'm missing here? Or have
a better way of performing this trick?

Reply via email to