I have a grid, when i click on the edit button it goes to edit page... but i need the value in the grid also to be passed to the page.
this.dispatchEvent(new DepManagementEvent(DepManagementEvent.EDIT_NAVI));
The above code lands in EDIT page... how can i move the values too.
My Parent Page code.
private function editForm():开发者_如何学Cvoid {
var event:DepManagementEvent = new DepManagementEvent("Edit Page",true);
dispatchEvent(event);
}
The Edit Page below....
public function init(event:DepManagementEvent):void {
this.addEventListener(DepManagementEvent.EDIT_NAVI, onEditNavi);
}
public function onEditNavi(event:DepManagementEvent):void {
Alert.show("as");
}
I am not getting the alert, when the page is navigated from the parent one.... on click. Also edit this code on how i can pass the variables too.
Add a public var (called "navi" in the code below) to the DepManagementEvent that's of the same type as the item in the grid, then dispatch the event like this instead:
var event:DepManagementEvent = new DepManagementEvent( DepManagementEvent.EDIT_NAVI );
event.navi = grid.selectedItem;
dispatchEvent( event );
To listen to the event on the other side, you add an event listener for a function...
addEventListener( DepManagementEvent.EDIT_NAVI, onEditNavi);
private function onEditNavi( event:DepManagementEvent ):void
{
// add logic here
}
Since you're in an itemRenderer, you can dispatch a bubbling event that will move up to the parent List/DataGrid and continue to bubble up to other parent views in the display hierarchy. When you create the event, pass the second argument ("bubbles") as true:
new DepManagementEvent( DepManagementEvent.EDIT_NAVI, true );
精彩评论