Re: [flexcoders] DataGrid.labelFunction
This works, but my code in my main app doesn't work... imagine that alskdjflajdlksfjl kasfdlaksj dfliasjdlifj o asdlfj ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; initialize=initApp(); mx:Script ![CDATA[ function initApp() { datagrid1.labelFunction = test; datagrid1.dataProvider = [{col1: sup, col2: g money}]; } function test(item, colName) { return cow; } ]] /mx:Script mx:DataGrid id=datagrid1 mx:columns mx:Array mx:DataGridColumn headerText=Column 1 columnName=col1 / mx:DataGridColumn headerText=Column 2 columnName=col2 / /mx:Array /mx:columns /mx:DataGrid /mx:Application - Original Message - From: JesterXL [EMAIL PROTECTED] To: Flexcoders flexcoders@yahoogroups.com Sent: Tuesday, May 17, 2005 4:19 PM Subject: [flexcoders] DataGrid.labelFunction I cannot get this to work. I've tried: my_datagrid.labelFunction = Delegate.create(this, onMyLabelFunction); my_datagrid.labelFunction = onMyLabelFunction; As well as through the attribute in the datagrid tag: mx:DataGrid labelFunction=onMyLabelFunction I can trace out that it's actually setting the value to a valid function through the debugger and me tracing out the values to a TextArea, but that same debugging session shows the actual function itself never getting run. I've tried setting the dataProviders right after, 1 frame after, and even 2 frames after via multiple doLaters. I've tried setting the ViewStack hosting this component to to auto creationLayout instead of all, and used childrenCreated to defer the actual setup. Nothing works. :: whips out gak and unloads a few rounds into monitor :: --JesterXL Yahoo! Groups Links Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
RE: [flexcoders] DataGrid.labelFunction
Maybe the signature of your function is not the right one, try using : private function onMyLabelFunction (item , columnName) : String { From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of JesterXL Sent: Tuesday, May 17, 2005 3:20 PM To: Flexcoders Subject: [flexcoders] DataGrid.labelFunction I cannot get this to work. I've tried: my_datagrid.labelFunction = Delegate.create(this, onMyLabelFunction); my_datagrid.labelFunction = onMyLabelFunction; As well as through the attribute in the datagrid tag: mx:DataGrid labelFunction=onMyLabelFunction I can trace out that it's actually setting the value to a valid function through the debugger and me tracing out the values to a TextArea, but that same debugging session shows the actual function itself never getting run. I've tried setting the dataProviders right after, 1 frame after, and even 2 frames after via multiple doLaters. I've tried setting the ViewStack hosting this component to to auto creationLayout instead of all, and used childrenCreated to defer the actual setup. Nothing works. :: whips out gak and unloads a few rounds into monitor :: --JesterXL Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Re: [flexcoders] DataGrid.labelFunction
Can someone explain why this doesn't work with the labelFunction? ?xml version="1.0" encoding="utf-8"?mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"mx:Script![CDATA[ import mx.utils.Delegate; function test(item, colName){return "cow";} function doStuff(){var d = view.getChildAt(0);//d.datagrid1.labelFunction = Delegate.create(this, test);d.datagrid1.labelFunction = test;} function traceIt(){var d = view.getChildAt(0);d.datagrid1.dataProvider = [{col1: "sup", col2: "g money"}];} ]]/mx:Scriptmx:Button label="Label Function" click="doStuff();" /mx:Button label="Set Dataprovider" click="traceIt();" /mx:ViewStack id="view" creationPolicy="all" mx:VBox id="myVB" mx:DataGrid id="datagrid1" mx:columns mx:Array mx:DataGridColumn headerText="Column 1" columnName="col1" / mx:DataGridColumn headerText="Column 2" columnName="col2" / /mx:Array /mx:columns /mx:DataGrid /mx:VBox /mx:ViewStack/mx:Application Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Re: [flexcoders] DataGrid.labelFunction
Just a guess looking at the Flash code (if someone could confirm in the REAL Flex classes which I haven't got). - it seems mx.controls.listclasses.SelectableRow has it's owner property set when it's created to know scope. This scope is used to call labelFunction. - SelectableRow is the default cellRenderer for ScrollSelect list, which DataGrid extends. SelectableRow creates rows using ScrollSelectList by default for the cellRenderer, which he sets the owner to this, the DataGrid - since the DataGrid's labelFunction property is already set, when the SelectableRow is looking for a label, and calls labelFunction on the DataGrid, it's really doing: theDataGrid.labelFunction(object) Now, since Flex changes this, so for DataGrids you also get the columnName, I'm thinking that change might of not been tested heavily with DataGrids in ViewStacks. Either that, or I'm missing something horribly obvious. Anyone have a mx.controls.listclasses.SelectableRow.as file to send me for Flex so I can see? - Original Message - From: JesterXL To: flexcoders@yahoogroups.com Sent: Tuesday, May 17, 2005 4:57 PM Subject: Re: [flexcoders] DataGrid.labelFunction Can someone explain why this doesn't work with the labelFunction? ?xml version="1.0" encoding="utf-8"?mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"mx:Script![CDATA[ import mx.utils.Delegate; function test(item, colName){return "cow";} function doStuff(){var d = view.getChildAt(0);//d.datagrid1.labelFunction = Delegate.create(this, test);d.datagrid1.labelFunction = test;} function traceIt(){var d = view.getChildAt(0);d.datagrid1.dataProvider = [{col1: "sup", col2: "g money"}];} ]]/mx:Scriptmx:Button label="Label Function" click="doStuff();" /mx:Button label="Set Dataprovider" click="traceIt();" /mx:ViewStack id="view" creationPolicy="all" mx:VBox id="myVB" mx:DataGrid id="datagrid1" mx:columns mx:Array mx:DataGridColumn headerText="Column 1" columnName="col1" / mx:DataGridColumn headerText="Column 2" columnName="col2" / /mx:Array /mx:columns /mx:DataGrid /mx:VBox /mx:ViewStack/mx:Application Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.