|
Close…..few questions. And I guess I
should have clarified, but I’m using Flex 2 at the moment. I’ve
narrowed it down so I have 0 errors, but nothing is calling my listener :-/
2) I’m assuming all those
Delegate.create are for Flex 1.5
AFTAsDG.addEventListener("refreshService", refreshAFTA); } public function refreshAFTA() { myAFTAService.url = "">"AFTAs.cfm?show=true"; CursorManager.setBusyCursor(); myAFTAService.send(); } Lower in the main
file: <mx:Metadata> [Event("refreshService")] </mx:Metadata> <mx:DataGrid creationComplete="AFTAComplete()"
id="AFTAsDG"
width="100%"
height="95%"
dataProvider="{myAFTAService.result.query.row}"> <mx:columns> <mx:Array> <mx:DataGridColumn headerText="CTRL" cellRenderer="MenuButton" width="45" textAlign="center"/> </mx:Array> </mx:columns> </mx:DataGrid> In MenuButton.mxml: <mx:Script> <![CDATA[ import flash.events.Event; public function deleteDev() { if(dataObject.additional == "no") { Alert.show("Sorry,
this is the main developer","Error",Alert.OK); } else { Alert.show("Deleting:
"+dataObject.INTRA_USERID,"Event",Alert.OK); } deleteBtn.dispatchEvent(new Event('refreshService')); } ]]> </mx:Script> <mx:Button id="deleteBtn" label="- " width="17" height="17" textAlign="right"
click="deleteDev()"/> </mx:HBox> Least right now I’m not getting errors, but
nothing is calling refreshAFTA _________________________________________ Jonathan Miranda Flexible Master of the Web "In the
game of chess, it's important to never let your opponent see your pieces." From: Here's the basic steps for Flex 1.5: - put a button in your cellrenderer - if ActionScript, register for the click event, and provide
a click function delegate in the cell renderer - if MXML, point click event to a event handler function in
the cellrenderer - in your event handler for the button's click, have it
dispatch an event - in your DataGrid container, register for the custom click
event; can only do this via code since you made up the event name, and
DataGrid.as won't have your event in the metadata So, some psuedo code for your cellrenderer: var ref:Button = Button(createChild(Button)); ref.addEventListener("click",
Delegate.create(this, onClick)); function onClick(event:Object):Void { listOwner.dispatchEvent({type:
"makeNameForThisEventMeaningful", target: listOwner, bubbles: true}); } And, some code for your container: function onCreationComplete() {
yourDataGrid.addEventListener("makeNameForThisEventMeaningful",
Delegate.create(this, onClicked)); } function onClicked(event:Object):Void { // button was clicked in datagrid, do
HTTPService.send stuff } Make sense? ----- Original Message ----- From: Jonathan
Miranda Sent: Tuesday, January
31, 2006 1:13 PM Subject: RE: [flexcoders]
DataGrid Renderer and referencing back Hey jester, thanks for the reply…but
could give a real basic example of this? So would I need someEventObject in both
the application mxml and the renderer mxml so that it would call both? _________________________________________ Jonathan Miranda Flexible Master of the Web "In the
game of chess, it's important to never let your opponent see your pieces." From: You can dispatch an event that bubbles in your cellrenderer,
and your main app can catch this event, and then resend the HTTPService.
Since the event is not internal to DataGrid's metadata, you can only subscribe
via code. ----- Original Message ----- From: Jonathan
Miranda Sent: Tuesday, January
31, 2006 12:29 PM Subject: [flexcoders]
DataGrid Renderer and referencing back I have a custom cellRenderer which has a button in
it…and when that button is pressed, I want to force the datagrid to
resend it’s HTTPService to get an update. How can I reference my
HTTPService in the main app, when my custom cellRenderer is in a separate mxml
file? _________________________________________ Jonathan Miranda Flexible Master of
the Web
|

