Apache – flex: how to refresh (reinitialize) list

apache-flex

I am a Java developer who tries Flex.

So my new problem is such:

I have a list component in Flex filled by objects got from Java (by binding dataprovider).
I have put drag-drop support on list.
Everything is good.
But I wanted to have a reset function to reinitialize list, namely get back drag-dropped elements to the list.

I tried several thing on event handler of reset button but could not reinitialise the list data. For example:

public function resetList():void {
        trace("reset")
        listsrc.dataProvider = srv.getTerritories.lastResult
    }

"reset" is debugged but there is no change on list.

Thanks;

Best Answer

another way to do this is to have the control be bound to a arrayCollection that is bindable.

[Bindable]
var listDP:Array; 

in mxml code

listsrc.dataProvider = listDP;

in actionScript whenever you are getting it from the server

listDP = srv.getTerritories.send();

By doing it this way you don't have to have your control instantiated before requesting data from the server.

Related Topic