[flexcoders] Re: DataGrid ItemRenderer Problem
Perfect thanks! Forgot all about outerDocument :-) --- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote: Try outerDocument On 5/25/10 10:16 PM, jmfillman jmfill...@... wrote: I have an itemRenderer: mx:DataGridColumn headerText= dataField=remove width=20 mx:itemRenderer fx:Component mx:Image source=assets/Remove-32.png height=20 width=20 useHandCursor=true buttonMode=true click=trace (parentDocument); parentDocument.removeItem()/ /fx:Component /mx:itemRenderer When I first load the state where the DataGrid is, add items to the grid, remove items from the grid, etc., the trace returns the root application (My_Site). When I subsequently change states and then back to the state where the DataGrid is located, the trace returns the container: My_Site.ApplicationSkin2._ApplicationSkin_Group1.contentGroup._My_Site_SkinnableContainer1.mainContainer6 This causes an error, so the question is, how do I call the function regardless. -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
[flexcoders] Re: Datagrid itemrenderer for adding multiple linkbuttons in same gridcolumn
Yes you're right, I am sure I am making it more complicated than it should be. The way I had it, was that in my renderer class (which extends DataGridItemRenderer) depending on the column I would add another (I think it is termed) dropin renderer , one column was rendered with a link button, the other one with the linkbar. But for the life of me I don't understand why I can't add a listener to the linkbar that way. Forget adding a listenener on the linkbar buttons, the only way the row click event for the datagrid would work is if I clicked just outside of the linkbar but still within the cell so I couldn't even use the click event for the datagrid. Clicking on the button on the linkbar itself went nowhere. Maybe it has something to do with putting a renderer within a renderer?? If you can follow what I did, please explain where in the world that mouseclick listener event would go and why I couldn't add the listener the parent renderer class (the one that extended DataGridItemRenderer). I scratched all that and ended up making a separate mxml renderer for that column and instead of a linkbar, I just added a vbox with a repeater for generating hboxes with link buttons in them as in this link http://forums.adobe.com/message/164232#164232. I may have overdid it on that one too but at least the eventlistener works. I really do appreciate the responses. Thanks for everyone's help! --- In flexcoders@yahoogroups.com, valdhor valdhorli...@... wrote: I thionk you are over thinking this. All you need to do is extend the class you wish to use as your item renderer. In the extended class, either add an event listener or override a handler. In this case, that class is LinkBar. The LinkBar class has a clickHandler method already so you override that method to do what you want. So, an Item Renderer based on LinkBar could look like: package Renderers { import flash.events.MouseEvent; import flash.net.*; import mx.controls.LinkBar; public class LinkBarRenderer extends LinkBar { public function LinkBarRenderer() { super(); } override public function set data(value:Object):void { super.data = value; if(value != null) { var linksArray:Array = data.WebSites.split(,); dataProvider = linksArray; } } override protected function clickHandler(event:MouseEvent):void { navigateToURL(new URLRequest(http://; + event.target.label), '_blank'); } } } HTH Steve --- In flexcoders@yahoogroups.com, aramsdell2000 aramsdell2000@ wrote: I have put aside the thoughts of making fancy hyperlinks, now I am just trying to understand events in the itemrenderer. I am ashamed to say that even after searching this subject in the forum and googling it, I still find myself struggling. I ended up trying a LinkBar as Tino suggested in the itemrenderer: else if (column.dataField == monitorlocations){ var linksArray:Array = String((data[monitorlocations])).split(\n); var linkbarItemRendererFactory:ClassFactory = new ClassFactory(LinkBar); linkbarItemRendererFactory.properties = {dataProvider:linksArray, direction:vertical,enabled:true }; column.itemRenderer = linkbarItemRendererFactory; column.setStyle(verticalGap,5); column.addEventListener(ItemClickEvent.ITEM_CLICK, linkBarEventHandler); Problem is that it seems like the click event on the button on the linkbar never makes it to the linkBarEventHandler which is a function inside this itemrenderer. I would at least think that this event would fire but setting a breakpoint in this eventhandler fuction, I can tell it never makes it there. The datagrid itemclick event doesn't even get called like it does in the other columns, which I think is a good indication that I can bubble up the linkbar clickItem event, I just can't figure out what I am doing wrong or even how to capture in a debug session what happens on that click event. One post I read says : Re: [flexcoders] Listem to an event sent by a DataGrid ItemRenderer In your item renderer, if you have control over the TimerEvent creation, set the bubbles parameter to true. If you do not, you may want to catch the event in the renderer and re-dispatch a new one with bubbles set to true. This will allow your event to bubble out, up the parental chain until it reaches your application. Then all you need to do is register for the event at the Application level. Can I set the bubbles property to true somehow using the ItemRendererFactory approach I have above? If I can't, theoretically I can dispatch the event from the eventhandler (if I could get it to fire) and then listen for it in the file that my datagrid is created in. Alternative to bubbling up an event, maybe
[flexcoders] Re: Datagrid itemrenderer for adding multiple linkbuttons in same gridcolumn
I can understand how Flex could get confused with a renderer inside a renderer (I'm confused). There is no telling where an event would get dispatched to. It probably has something to do with scope. --- In flexcoders@yahoogroups.com, aramsdell2000 aramsdell2...@... wrote: Yes you're right, I am sure I am making it more complicated than it should be. The way I had it, was that in my renderer class (which extends DataGridItemRenderer) depending on the column I would add another (I think it is termed) dropin renderer , one column was rendered with a link button, the other one with the linkbar. But for the life of me I don't understand why I can't add a listener to the linkbar that way. Forget adding a listenener on the linkbar buttons, the only way the row click event for the datagrid would work is if I clicked just outside of the linkbar but still within the cell so I couldn't even use the click event for the datagrid. Clicking on the button on the linkbar itself went nowhere. Maybe it has something to do with putting a renderer within a renderer?? If you can follow what I did, please explain where in the world that mouseclick listener event would go and why I couldn't add the listener the parent renderer class (the one that extended DataGridItemRenderer). I scratched all that and ended up making a separate mxml renderer for that column and instead of a linkbar, I just added a vbox with a repeater for generating hboxes with link buttons in them as in this link http://forums.adobe.com/message/164232#164232. I may have overdid it on that one too but at least the eventlistener works. I really do appreciate the responses. Thanks for everyone's help! --- In flexcoders@yahoogroups.com, valdhor valdhorlists@ wrote: I thionk you are over thinking this. All you need to do is extend the class you wish to use as your item renderer. In the extended class, either add an event listener or override a handler. In this case, that class is LinkBar. The LinkBar class has a clickHandler method already so you override that method to do what you want. So, an Item Renderer based on LinkBar could look like: package Renderers { import flash.events.MouseEvent; import flash.net.*; import mx.controls.LinkBar; public class LinkBarRenderer extends LinkBar { public function LinkBarRenderer() { super(); } override public function set data(value:Object):void { super.data = value; if(value != null) { var linksArray:Array = data.WebSites.split(,); dataProvider = linksArray; } } override protected function clickHandler(event:MouseEvent):void { navigateToURL(new URLRequest(http://; + event.target.label), '_blank'); } } } HTH Steve --- In flexcoders@yahoogroups.com, aramsdell2000 aramsdell2000@ wrote: I have put aside the thoughts of making fancy hyperlinks, now I am just trying to understand events in the itemrenderer. I am ashamed to say that even after searching this subject in the forum and googling it, I still find myself struggling. I ended up trying a LinkBar as Tino suggested in the itemrenderer: else if (column.dataField == monitorlocations){ var linksArray:Array = String((data[monitorlocations])).split(\n); var linkbarItemRendererFactory:ClassFactory = new ClassFactory(LinkBar); linkbarItemRendererFactory.properties = {dataProvider:linksArray, direction:vertical,enabled:true }; column.itemRenderer = linkbarItemRendererFactory; column.setStyle(verticalGap,5); column.addEventListener(ItemClickEvent.ITEM_CLICK, linkBarEventHandler); Problem is that it seems like the click event on the button on the linkbar never makes it to the linkBarEventHandler which is a function inside this itemrenderer. I would at least think that this event would fire but setting a breakpoint in this eventhandler fuction, I can tell it never makes it there. The datagrid itemclick event doesn't even get called like it does in the other columns, which I think is a good indication that I can bubble up the linkbar clickItem event, I just can't figure out what I am doing wrong or even how to capture in a debug session what happens on that click event. One post I read says : Re: [flexcoders] Listem to an event sent by a DataGrid ItemRenderer In your item renderer, if you have control over the TimerEvent creation, set the bubbles parameter to true. If you do not, you may want to catch the event in the renderer and re-dispatch a new one with bubbles set to true. This will allow your event to bubble out, up the parental chain until it reaches your application. Then all
[flexcoders] Re: Datagrid itemrenderer for adding multiple linkbuttons in same gridcolumn
I thionk you are over thinking this. All you need to do is extend the class you wish to use as your item renderer. In the extended class, either add an event listener or override a handler. In this case, that class is LinkBar. The LinkBar class has a clickHandler method already so you override that method to do what you want. So, an Item Renderer based on LinkBar could look like: package Renderers { import flash.events.MouseEvent; import flash.net.*; import mx.controls.LinkBar; public class LinkBarRenderer extends LinkBar { public function LinkBarRenderer() { super(); } override public function set data(value:Object):void { super.data = value; if(value != null) { var linksArray:Array = data.WebSites.split(,); dataProvider = linksArray; } } override protected function clickHandler(event:MouseEvent):void { navigateToURL(new URLRequest(http://; + event.target.label), '_blank'); } } } HTH Steve --- In flexcoders@yahoogroups.com, aramsdell2000 aramsdell2...@... wrote: I have put aside the thoughts of making fancy hyperlinks, now I am just trying to understand events in the itemrenderer. I am ashamed to say that even after searching this subject in the forum and googling it, I still find myself struggling. I ended up trying a LinkBar as Tino suggested in the itemrenderer: else if (column.dataField == monitorlocations){ var linksArray:Array = String((data[monitorlocations])).split(\n); var linkbarItemRendererFactory:ClassFactory = new ClassFactory(LinkBar); linkbarItemRendererFactory.properties = {dataProvider:linksArray, direction:vertical,enabled:true }; column.itemRenderer = linkbarItemRendererFactory; column.setStyle(verticalGap,5); column.addEventListener(ItemClickEvent.ITEM_CLICK, linkBarEventHandler); Problem is that it seems like the click event on the button on the linkbar never makes it to the linkBarEventHandler which is a function inside this itemrenderer. I would at least think that this event would fire but setting a breakpoint in this eventhandler fuction, I can tell it never makes it there. The datagrid itemclick event doesn't even get called like it does in the other columns, which I think is a good indication that I can bubble up the linkbar clickItem event, I just can't figure out what I am doing wrong or even how to capture in a debug session what happens on that click event. One post I read says : Re: [flexcoders] Listem to an event sent by a DataGrid ItemRenderer In your item renderer, if you have control over the TimerEvent creation, set the bubbles parameter to true. If you do not, you may want to catch the event in the renderer and re-dispatch a new one with bubbles set to true. This will allow your event to bubble out, up the parental chain until it reaches your application. Then all you need to do is register for the event at the Application level. Can I set the bubbles property to true somehow using the ItemRendererFactory approach I have above? If I can't, theoretically I can dispatch the event from the eventhandler (if I could get it to fire) and then listen for it in the file that my datagrid is created in. Alternative to bubbling up an event, maybe somehow I can add an eventlistener that calls a function using owner.document.myFunction? --- In flexcoders@yahoogroups.com, valdhor valdhorlists@ wrote: As far as I know the code is open source but you could add a comment at his blog (http://www.jabbypanda.com/blog/?p=28). You will either have to disable the datagrids click event handler on that specific column or figure out a way to put each link in its own column. --- In flexcoders@yahoogroups.com, aramsdell2000 aramsdell2000@ wrote: Actually I am not so sure how this will work in a datagrid. One datagrid cell would have multiple hyperlink buttons. Right now the click event for the datagrid behaves differently depending on which column you click. In another column I have one link button per row. But for this one, I would have several link buttons in one row's cell. Do I do nothing on the datagrid's click event and then the listerner events for the links would take over? Haven't tried anything yet, just thinking about how to approach it. Thanks! --- In flexcoders@yahoogroups.com, aramsdell2000 aramsdell2000@ wrote: Oh wow, this looks great! Thank you! This looks like what I want to do, just curious, how do I cite it if I use it/ modified version of it?? I can add a link to his website and blog in the code? --- In flexcoders@yahoogroups.com, valdhor valdhorlists@ wrote: Here is a quick and dirty example using the hyperlink component from jabbypanda (http://jabbypanda.com/labs/hyperLink/srcview/index.html): ?xml version=1.0 encoding=utf-8?
[flexcoders] Re: Datagrid itemrenderer for adding multiple linkbuttons in same gridcolumn
I have put aside the thoughts of making fancy hyperlinks, now I am just trying to understand events in the itemrenderer. I am ashamed to say that even after searching this subject in the forum and googling it, I still find myself struggling. I ended up trying a LinkBar as Tino suggested in the itemrenderer: else if (column.dataField == monitorlocations){ var linksArray:Array = String((data[monitorlocations])).split(\n); var linkbarItemRendererFactory:ClassFactory = new ClassFactory(LinkBar); linkbarItemRendererFactory.properties = {dataProvider:linksArray, direction:vertical,enabled:true }; column.itemRenderer = linkbarItemRendererFactory; column.setStyle(verticalGap,5); column.addEventListener(ItemClickEvent.ITEM_CLICK, linkBarEventHandler); Problem is that it seems like the click event on the button on the linkbar never makes it to the linkBarEventHandler which is a function inside this itemrenderer. I would at least think that this event would fire but setting a breakpoint in this eventhandler fuction, I can tell it never makes it there. The datagrid itemclick event doesn't even get called like it does in the other columns, which I think is a good indication that I can bubble up the linkbar clickItem event, I just can't figure out what I am doing wrong or even how to capture in a debug session what happens on that click event. One post I read says : Re: [flexcoders] Listem to an event sent by a DataGrid ItemRenderer In your item renderer, if you have control over the TimerEvent creation, set the bubbles parameter to true. If you do not, you may want to catch the event in the renderer and re-dispatch a new one with bubbles set to true. This will allow your event to bubble out, up the parental chain until it reaches your application. Then all you need to do is register for the event at the Application level. Can I set the bubbles property to true somehow using the ItemRendererFactory approach I have above? If I can't, theoretically I can dispatch the event from the eventhandler (if I could get it to fire) and then listen for it in the file that my datagrid is created in. Alternative to bubbling up an event, maybe somehow I can add an eventlistener that calls a function using owner.document.myFunction? --- In flexcoders@yahoogroups.com, valdhor valdhorli...@... wrote: As far as I know the code is open source but you could add a comment at his blog (http://www.jabbypanda.com/blog/?p=28). You will either have to disable the datagrids click event handler on that specific column or figure out a way to put each link in its own column. --- In flexcoders@yahoogroups.com, aramsdell2000 aramsdell2000@ wrote: Actually I am not so sure how this will work in a datagrid. One datagrid cell would have multiple hyperlink buttons. Right now the click event for the datagrid behaves differently depending on which column you click. In another column I have one link button per row. But for this one, I would have several link buttons in one row's cell. Do I do nothing on the datagrid's click event and then the listerner events for the links would take over? Haven't tried anything yet, just thinking about how to approach it. Thanks! --- In flexcoders@yahoogroups.com, aramsdell2000 aramsdell2000@ wrote: Oh wow, this looks great! Thank you! This looks like what I want to do, just curious, how do I cite it if I use it/ modified version of it?? I can add a link to his website and blog in the code? --- In flexcoders@yahoogroups.com, valdhor valdhorlists@ wrote: Here is a quick and dirty example using the hyperlink component from jabbypanda (http://jabbypanda.com/labs/hyperLink/srcview/index.html): ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute width=700 mx:Script ![CDATA[ import mx.collections.ArrayCollection; [Bindable] public var initDG:ArrayCollection = new ArrayCollection([ {Company: 'Apple Computer', WebSites: 'www.apple.com,store.apple.com,developer.apple.com'}, {Company: 'Google', WebSites: 'www.google.com,code.google.com,mail.google.com'} ]); ]] /mx:Script mx:DataGrid id=myGrid dataProvider={initDG} rowCount={initDG.length} mx:columns mx:DataGridColumn width=120 dataField=Company editable=false/ mx:DataGridColumn width=500 dataField=WebSites itemRenderer=Renderers.LinksRenderer/ /mx:columns /mx:DataGrid /mx:Application LinksRenderer.as: package Renderers { import flash.net.*; import htmltext.controls.HyperLink; import htmltext.controls.events.HyperlinkEvent; import mx.containers.HBox; public class LinksRenderer extends
[flexcoders] Re: Datagrid itemrenderer for adding multiple linkbuttons in same gridcolumn
--- In flexcoders@yahoogroups.com, aramsdell2000 aramsdell2...@... wrote: I have put aside the thoughts of making fancy hyperlinks, now I am just trying to understand events in the itemrenderer. I am ashamed to say that even after searching this subject in the forum and googling it, I still find myself struggling. I ended up trying a LinkBar as Tino suggested in the itemrenderer: else if (column.dataField == monitorlocations){ var linksArray:Array = String((data[monitorlocations])).split(\n); var linkbarItemRendererFactory:ClassFactory = new ClassFactory(LinkBar); linkbarItemRendererFactory.properties = {dataProvider:linksArray, direction:vertical,enabled:true }; column.itemRenderer = linkbarItemRendererFactory; column.setStyle(verticalGap,5); column.addEventListener(ItemClickEvent.ITEM_CLICK, linkBarEventHandler); Problem is that it seems like the click event on the button on the linkbar never makes it to the linkBarEventHandler which is a function inside this itemrenderer. I would at least think that this event would fire but setting a breakpoint in this eventhandler fuction, I can tell it never makes it there. The datagrid itemclick event doesn't even get called like it does in the other columns, which I think is a good indication that I can bubble up the linkbar clickItem event, I just can't figure out what I am doing wrong or even how to capture in a debug session what happens on that click event. If the linkBarEventHandler is a function inside the item renderer, I would expect you to get a compile error, since the function would be defined in a scope that the parent does not have access to, especially since when the factory is defined, no instances of it exist. If you want to have an event handler in the itemRenderer, attach the event listener inside the item renderer, either in MXML or in AS. The itemClick event of NavBar does not bubble, so the only place you can listen for it is inside the itemRenderer. This is a separate and distinct event from the ListBase itemClick, which will give you information about the entire object that is represented in the DataGrid row. You could potentially catch the NavBar itemClick in your renderer and create your own bubbling event that describes what happened. You could also just listen for a mouse click anywhere on the DataGrid and check the target property to see if the LinkBar is in some way a parent of whatever was clicked. HTH; Amy
[flexcoders] Re: Datagrid itemrenderer for adding multiple linkbuttons in same gridcolumn
As far as I know the code is open source but you could add a comment at his blog (http://www.jabbypanda.com/blog/?p=28). You will either have to disable the datagrids click event handler on that specific column or figure out a way to put each link in its own column. --- In flexcoders@yahoogroups.com, aramsdell2000 aramsdell2...@... wrote: Actually I am not so sure how this will work in a datagrid. One datagrid cell would have multiple hyperlink buttons. Right now the click event for the datagrid behaves differently depending on which column you click. In another column I have one link button per row. But for this one, I would have several link buttons in one row's cell. Do I do nothing on the datagrid's click event and then the listerner events for the links would take over? Haven't tried anything yet, just thinking about how to approach it. Thanks! --- In flexcoders@yahoogroups.com, aramsdell2000 aramsdell2000@ wrote: Oh wow, this looks great! Thank you! This looks like what I want to do, just curious, how do I cite it if I use it/ modified version of it?? I can add a link to his website and blog in the code? --- In flexcoders@yahoogroups.com, valdhor valdhorlists@ wrote: Here is a quick and dirty example using the hyperlink component from jabbypanda (http://jabbypanda.com/labs/hyperLink/srcview/index.html): ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute width=700 mx:Script ![CDATA[ import mx.collections.ArrayCollection; [Bindable] public var initDG:ArrayCollection = new ArrayCollection([ {Company: 'Apple Computer', WebSites: 'www.apple.com,store.apple.com,developer.apple.com'}, {Company: 'Google', WebSites: 'www.google.com,code.google.com,mail.google.com'} ]); ]] /mx:Script mx:DataGrid id=myGrid dataProvider={initDG} rowCount={initDG.length} mx:columns mx:DataGridColumn width=120 dataField=Company editable=false/ mx:DataGridColumn width=500 dataField=WebSites itemRenderer=Renderers.LinksRenderer/ /mx:columns /mx:DataGrid /mx:Application LinksRenderer.as: package Renderers { import flash.net.*; import htmltext.controls.HyperLink; import htmltext.controls.events.HyperlinkEvent; import mx.containers.HBox; public class LinksRenderer extends HBox { private var link1:HyperLink = new HyperLink(); private var link2:HyperLink = new HyperLink(); private var link3:HyperLink = new HyperLink(); public function LinksRenderer() { super(); } override public function set data(value:Object):void { super.data = value; if(value != null) { var linksArray:Array = data.WebSites.split(,); link1.linkText = linksArray[0]; link1.addEventListener(HyperlinkEvent.HYPERLINK_CLICK, hyperLinkClicked); link2.linkText = linksArray[1]; link2.addEventListener(HyperlinkEvent.HYPERLINK_CLICK, hyperLinkClicked); link3.linkText = linksArray[2]; link3.addEventListener(HyperlinkEvent.HYPERLINK_CLICK, hyperLinkClicked); addChild(link1); addChild(link2); addChild(link3); } } private function hyperLinkClicked(event:HyperlinkEvent):void { navigateToURL(new URLRequest(http://; + event.target.linkText), '_blank'); } } } --- In flexcoders@yahoogroups.com, Tino Dai oberoc@ wrote: Have you looked at the class LinkBar? I think that would be a good way to return a multiple buttons in a cell of a datagrid. http://livedocs.adobe.com/flex/3/langref/mx/controls/LinkBar.html -Tino On Wed, Jan 13, 2010 at 10:11 AM, aramsdell2000 aramsdell2000@: OK, that's the problem. I don't know how to add multiple link buttons through action script. And here goes my feeble attempt at explaining what I did so that it makes sense: This is how I am now populating the column with multiple hyperlinks, using the itemrenderer approach from Alex's Flex Closet HTML in an Item Renderer on this website: http://blogs.adobe.com/aharui/item_renderers/ var params:Array = (data[column.dataField]).split(, ); var urls:String = ; for (var i:Number=0; i params.length; i++) { ... urls += a href='http://webaddress?charname=; + params[i] + amp;someid= + station +
[flexcoders] Re: Datagrid itemrenderer for adding multiple linkbuttons in same gridcolumn
Oh wow, this looks great! Thank you! This looks like what I want to do, just curious, how do I cite it if I use it/ modified version of it?? I can add a link to his website and blog in the code? --- In flexcoders@yahoogroups.com, valdhor valdhorli...@... wrote: Here is a quick and dirty example using the hyperlink component from jabbypanda (http://jabbypanda.com/labs/hyperLink/srcview/index.html): ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute width=700 mx:Script ![CDATA[ import mx.collections.ArrayCollection; [Bindable] public var initDG:ArrayCollection = new ArrayCollection([ {Company: 'Apple Computer', WebSites: 'www.apple.com,store.apple.com,developer.apple.com'}, {Company: 'Google', WebSites: 'www.google.com,code.google.com,mail.google.com'} ]); ]] /mx:Script mx:DataGrid id=myGrid dataProvider={initDG} rowCount={initDG.length} mx:columns mx:DataGridColumn width=120 dataField=Company editable=false/ mx:DataGridColumn width=500 dataField=WebSites itemRenderer=Renderers.LinksRenderer/ /mx:columns /mx:DataGrid /mx:Application LinksRenderer.as: package Renderers { import flash.net.*; import htmltext.controls.HyperLink; import htmltext.controls.events.HyperlinkEvent; import mx.containers.HBox; public class LinksRenderer extends HBox { private var link1:HyperLink = new HyperLink(); private var link2:HyperLink = new HyperLink(); private var link3:HyperLink = new HyperLink(); public function LinksRenderer() { super(); } override public function set data(value:Object):void { super.data = value; if(value != null) { var linksArray:Array = data.WebSites.split(,); link1.linkText = linksArray[0]; link1.addEventListener(HyperlinkEvent.HYPERLINK_CLICK, hyperLinkClicked); link2.linkText = linksArray[1]; link2.addEventListener(HyperlinkEvent.HYPERLINK_CLICK, hyperLinkClicked); link3.linkText = linksArray[2]; link3.addEventListener(HyperlinkEvent.HYPERLINK_CLICK, hyperLinkClicked); addChild(link1); addChild(link2); addChild(link3); } } private function hyperLinkClicked(event:HyperlinkEvent):void { navigateToURL(new URLRequest(http://; + event.target.linkText), '_blank'); } } } --- In flexcoders@yahoogroups.com, Tino Dai oberoc@ wrote: Have you looked at the class LinkBar? I think that would be a good way to return a multiple buttons in a cell of a datagrid. http://livedocs.adobe.com/flex/3/langref/mx/controls/LinkBar.html -Tino On Wed, Jan 13, 2010 at 10:11 AM, aramsdell2000 aramsdell2...@...: OK, that's the problem. I don't know how to add multiple link buttons through action script. And here goes my feeble attempt at explaining what I did so that it makes sense: This is how I am now populating the column with multiple hyperlinks, using the itemrenderer approach from Alex's Flex Closet HTML in an Item Renderer on this website: http://blogs.adobe.com/aharui/item_renderers/ var params:Array = (data[column.dataField]).split(, ); var urls:String = ; for (var i:Number=0; i params.length; i++) { ... urls += a href='http://webaddress?charname=; + params[i] + amp;someid= + station + amp;anotherid= + org + ' target='_blank' + params[i] + /a, ; } ... cdataTag = urls; . htmlText = cdataTag; but only a right click works to open a new window. I would like it to work with just clicking on the text like a normal HTML href. So what I wanted to do was have each string be a link button (except i don't really like the fact that it looks like a button). I have been experimenting with using a single linkbutton in a datagridcolumn for something similar: else if (column.dataField == details){ var linkItemRendererFactory:ClassFactory = new ClassFactory(LinkButton); var someid:String = data[someid]; var anotherid:String = data[anotherid]; var queryExpr:String = SomeParameterId= + someid + AnotherParameterId= + anotherid + restofurl; //this line isn't quite working either but I hope you get the idea.. //linkItemRendererFactory.properties = {label:data[column.dataField],click:callGetDetailsWebService( + queryExpr + );}; linkItemRendererFactory.properties = {label:data[column.dataField]}; column.itemRenderer = linkItemRendererFactory; I am not sure how to expand the above code to
[flexcoders] Re: Datagrid itemrenderer for adding multiple linkbuttons in same gridcolumn
Actually I am not so sure how this will work in a datagrid. One datagrid cell would have multiple hyperlink buttons. Right now the click event for the datagrid behaves differently depending on which column you click. In another column I have one link button per row. But for this one, I would have several link buttons in one row's cell. Do I do nothing on the datagrid's click event and then the listerner events for the links would take over? Haven't tried anything yet, just thinking about how to approach it. Thanks! --- In flexcoders@yahoogroups.com, aramsdell2000 aramsdell2...@... wrote: Oh wow, this looks great! Thank you! This looks like what I want to do, just curious, how do I cite it if I use it/ modified version of it?? I can add a link to his website and blog in the code? --- In flexcoders@yahoogroups.com, valdhor valdhorlists@ wrote: Here is a quick and dirty example using the hyperlink component from jabbypanda (http://jabbypanda.com/labs/hyperLink/srcview/index.html): ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute width=700 mx:Script ![CDATA[ import mx.collections.ArrayCollection; [Bindable] public var initDG:ArrayCollection = new ArrayCollection([ {Company: 'Apple Computer', WebSites: 'www.apple.com,store.apple.com,developer.apple.com'}, {Company: 'Google', WebSites: 'www.google.com,code.google.com,mail.google.com'} ]); ]] /mx:Script mx:DataGrid id=myGrid dataProvider={initDG} rowCount={initDG.length} mx:columns mx:DataGridColumn width=120 dataField=Company editable=false/ mx:DataGridColumn width=500 dataField=WebSites itemRenderer=Renderers.LinksRenderer/ /mx:columns /mx:DataGrid /mx:Application LinksRenderer.as: package Renderers { import flash.net.*; import htmltext.controls.HyperLink; import htmltext.controls.events.HyperlinkEvent; import mx.containers.HBox; public class LinksRenderer extends HBox { private var link1:HyperLink = new HyperLink(); private var link2:HyperLink = new HyperLink(); private var link3:HyperLink = new HyperLink(); public function LinksRenderer() { super(); } override public function set data(value:Object):void { super.data = value; if(value != null) { var linksArray:Array = data.WebSites.split(,); link1.linkText = linksArray[0]; link1.addEventListener(HyperlinkEvent.HYPERLINK_CLICK, hyperLinkClicked); link2.linkText = linksArray[1]; link2.addEventListener(HyperlinkEvent.HYPERLINK_CLICK, hyperLinkClicked); link3.linkText = linksArray[2]; link3.addEventListener(HyperlinkEvent.HYPERLINK_CLICK, hyperLinkClicked); addChild(link1); addChild(link2); addChild(link3); } } private function hyperLinkClicked(event:HyperlinkEvent):void { navigateToURL(new URLRequest(http://; + event.target.linkText), '_blank'); } } } --- In flexcoders@yahoogroups.com, Tino Dai oberoc@ wrote: Have you looked at the class LinkBar? I think that would be a good way to return a multiple buttons in a cell of a datagrid. http://livedocs.adobe.com/flex/3/langref/mx/controls/LinkBar.html -Tino On Wed, Jan 13, 2010 at 10:11 AM, aramsdell2000 aramsdell2000@: OK, that's the problem. I don't know how to add multiple link buttons through action script. And here goes my feeble attempt at explaining what I did so that it makes sense: This is how I am now populating the column with multiple hyperlinks, using the itemrenderer approach from Alex's Flex Closet HTML in an Item Renderer on this website: http://blogs.adobe.com/aharui/item_renderers/ var params:Array = (data[column.dataField]).split(, ); var urls:String = ; for (var i:Number=0; i params.length; i++) { ... urls += a href='http://webaddress?charname=; + params[i] + amp;someid= + station + amp;anotherid= + org + ' target='_blank' + params[i] + /a, ; } ... cdataTag = urls; . htmlText = cdataTag; but only a right click works to open a new window. I would like it to work with just clicking on the text like a normal HTML href. So what I wanted to do was have each string be a link button (except i don't really like the fact that it looks like a button). I have been experimenting with using a single
[flexcoders] Re: Datagrid itemrenderer for adding multiple linkbuttons in same gridcolumn
Here is a quick and dirty example using the hyperlink component from jabbypanda (http://jabbypanda.com/labs/hyperLink/srcview/index.html): ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute width=700 mx:Script ![CDATA[ import mx.collections.ArrayCollection; [Bindable] public var initDG:ArrayCollection = new ArrayCollection([ {Company: 'Apple Computer', WebSites: 'www.apple.com,store.apple.com,developer.apple.com'}, {Company: 'Google', WebSites: 'www.google.com,code.google.com,mail.google.com'} ]); ]] /mx:Script mx:DataGrid id=myGrid dataProvider={initDG} rowCount={initDG.length} mx:columns mx:DataGridColumn width=120 dataField=Company editable=false/ mx:DataGridColumn width=500 dataField=WebSites itemRenderer=Renderers.LinksRenderer/ /mx:columns /mx:DataGrid /mx:Application LinksRenderer.as: package Renderers { import flash.net.*; import htmltext.controls.HyperLink; import htmltext.controls.events.HyperlinkEvent; import mx.containers.HBox; public class LinksRenderer extends HBox { private var link1:HyperLink = new HyperLink(); private var link2:HyperLink = new HyperLink(); private var link3:HyperLink = new HyperLink(); public function LinksRenderer() { super(); } override public function set data(value:Object):void { super.data = value; if(value != null) { var linksArray:Array = data.WebSites.split(,); link1.linkText = linksArray[0]; link1.addEventListener(HyperlinkEvent.HYPERLINK_CLICK, hyperLinkClicked); link2.linkText = linksArray[1]; link2.addEventListener(HyperlinkEvent.HYPERLINK_CLICK, hyperLinkClicked); link3.linkText = linksArray[2]; link3.addEventListener(HyperlinkEvent.HYPERLINK_CLICK, hyperLinkClicked); addChild(link1); addChild(link2); addChild(link3); } } private function hyperLinkClicked(event:HyperlinkEvent):void { navigateToURL(new URLRequest(http://; + event.target.linkText), '_blank'); } } } --- In flexcoders@yahoogroups.com, Tino Dai obe...@... wrote: Have you looked at the class LinkBar? I think that would be a good way to return a multiple buttons in a cell of a datagrid. http://livedocs.adobe.com/flex/3/langref/mx/controls/LinkBar.html -Tino On Wed, Jan 13, 2010 at 10:11 AM, aramsdell2000 aramsdell2...@...wrote: OK, that's the problem. I don't know how to add multiple link buttons through action script. And here goes my feeble attempt at explaining what I did so that it makes sense: This is how I am now populating the column with multiple hyperlinks, using the itemrenderer approach from Alex's Flex Closet HTML in an Item Renderer on this website: http://blogs.adobe.com/aharui/item_renderers/ var params:Array = (data[column.dataField]).split(, ); var urls:String = ; for (var i:Number=0; i params.length; i++) { ... urls += a href='http://webaddress?charname=; + params[i] + amp;someid= + station + amp;anotherid= + org + ' target='_blank' + params[i] + /a, ; } ... cdataTag = urls; . htmlText = cdataTag; but only a right click works to open a new window. I would like it to work with just clicking on the text like a normal HTML href. So what I wanted to do was have each string be a link button (except i don't really like the fact that it looks like a button). I have been experimenting with using a single linkbutton in a datagridcolumn for something similar: else if (column.dataField == details){ var linkItemRendererFactory:ClassFactory = new ClassFactory(LinkButton); var someid:String = data[someid]; var anotherid:String = data[anotherid]; var queryExpr:String = SomeParameterId= + someid + AnotherParameterId= + anotherid + restofurl; //this line isn't quite working either but I hope you get the idea.. //linkItemRendererFactory.properties = {label:data[column.dataField],click:callGetDetailsWebService( + queryExpr + );}; linkItemRendererFactory.properties = {label:data[column.dataField]}; column.itemRenderer = linkItemRendererFactory; I am not sure how to expand the above code to add multiple buttons. Instead of using an inline? renderer, do I have to make a new link button class and extend it or can I somehow write it into the custom CustomDataGridItemRenderer class I have now that extends DataGridItemRenderer. Hopefully that makes sense! Thanks! Amy --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Tino Dai oberoc@ wrote: Some code
Re: [flexcoders] Re: Datagrid itemrenderer for adding multiple linkbuttons in same gridcolumn
Have you looked at the class LinkBar? I think that would be a good way to return a multiple buttons in a cell of a datagrid. http://livedocs.adobe.com/flex/3/langref/mx/controls/LinkBar.html -Tino On Wed, Jan 13, 2010 at 10:11 AM, aramsdell2000 aramsdell2...@yahoo.comwrote: OK, that's the problem. I don't know how to add multiple link buttons through action script. And here goes my feeble attempt at explaining what I did so that it makes sense: This is how I am now populating the column with multiple hyperlinks, using the itemrenderer approach from Alex's Flex Closet HTML in an Item Renderer on this website: http://blogs.adobe.com/aharui/item_renderers/ var params:Array = (data[column.dataField]).split(, ); var urls:String = ; for (var i:Number=0; i params.length; i++) { ... urls += a href='http://webaddress?charname=; + params[i] + amp;someid= + station + amp;anotherid= + org + ' target='_blank' + params[i] + /a, ; } ... cdataTag = urls; . htmlText = cdataTag; but only a right click works to open a new window. I would like it to work with just clicking on the text like a normal HTML href. So what I wanted to do was have each string be a link button (except i don't really like the fact that it looks like a button). I have been experimenting with using a single linkbutton in a datagridcolumn for something similar: else if (column.dataField == details){ var linkItemRendererFactory:ClassFactory = new ClassFactory(LinkButton); var someid:String = data[someid]; var anotherid:String = data[anotherid]; var queryExpr:String = SomeParameterId= + someid + AnotherParameterId= + anotherid + restofurl; //this line isn't quite working either but I hope you get the idea.. //linkItemRendererFactory.properties = {label:data[column.dataField],click:callGetDetailsWebService( + queryExpr + );}; linkItemRendererFactory.properties = {label:data[column.dataField]}; column.itemRenderer = linkItemRendererFactory; I am not sure how to expand the above code to add multiple buttons. Instead of using an inline? renderer, do I have to make a new link button class and extend it or can I somehow write it into the custom CustomDataGridItemRenderer class I have now that extends DataGridItemRenderer. Hopefully that makes sense! Thanks! Amy --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Tino Dai obe...@... wrote: Some code would help On Tue, Jan 12, 2010 at 8:36 PM, aramsdell2000 amy.ramsd...@...wrote: I have a datagrid column that for each row, has several text values each with its own hyperlink. Ex: the data in the datafield looks like: Atext, Btext, Ctext. As it is now, I was able to add href anchor tags but they only open in a new window with the right mouse click. The datagrid item click event takes over the left mouse click and I am not sure how to prevent that. So I thought I would add multiple link buttons in the datagrid column instead. My question is how to add these multiple buttons using an itemrenderer in actionscript. If I was adding just one I would assume it would be datagrdcol.itemrenderer = new ClassFactory(LinkButton) and then you just set the properties of the link button. But how do you do it if there are multiple buttons for the data in the datafield. Do you extend the LinkButton or list data in a customitemrenderer class? How?
[flexcoders] Re: Datagrid itemrenderer for adding multiple linkbuttons in same gridcolumn
OK, that's the problem. I don't know how to add multiple link buttons through action script. And here goes my feeble attempt at explaining what I did so that it makes sense: This is how I am now populating the column with multiple hyperlinks, using the itemrenderer approach from Alex's Flex Closet HTML in an Item Renderer on this website: http://blogs.adobe.com/aharui/item_renderers/ var params:Array = (data[column.dataField]).split(, ); var urls:String = ; for (var i:Number=0; i params.length; i++) { ... urls += a href='http://webaddress?charname=; + params[i] + amp;someid= + station + amp;anotherid= + org + ' target='_blank' + params[i] + /a, ; } ... cdataTag = urls; . htmlText = cdataTag; but only a right click works to open a new window. I would like it to work with just clicking on the text like a normal HTML href. So what I wanted to do was have each string be a link button (except i don't really like the fact that it looks like a button). I have been experimenting with using a single linkbutton in a datagridcolumn for something similar: else if (column.dataField == details){ var linkItemRendererFactory:ClassFactory = new ClassFactory(LinkButton); var someid:String = data[someid]; var anotherid:String = data[anotherid]; var queryExpr:String = SomeParameterId= + someid + AnotherParameterId= + anotherid + restofurl; //this line isn't quite working either but I hope you get the idea.. //linkItemRendererFactory.properties = {label:data[column.dataField],click:callGetDetailsWebService( + queryExpr + );}; linkItemRendererFactory.properties = {label:data[column.dataField]}; column.itemRenderer = linkItemRendererFactory; I am not sure how to expand the above code to add multiple buttons. Instead of using an inline? renderer, do I have to make a new link button class and extend it or can I somehow write it into the custom CustomDataGridItemRenderer class I have now that extends DataGridItemRenderer. Hopefully that makes sense! Thanks! Amy --- In flexcoders@yahoogroups.com, Tino Dai obe...@... wrote: Some code would help On Tue, Jan 12, 2010 at 8:36 PM, aramsdell2000 amy.ramsd...@...wrote: I have a datagrid column that for each row, has several text values each with its own hyperlink. Ex: the data in the datafield looks like: Atext, Btext, Ctext. As it is now, I was able to add href anchor tags but they only open in a new window with the right mouse click. The datagrid item click event takes over the left mouse click and I am not sure how to prevent that. So I thought I would add multiple link buttons in the datagrid column instead. My question is how to add these multiple buttons using an itemrenderer in actionscript. If I was adding just one I would assume it would be datagrdcol.itemrenderer = new ClassFactory(LinkButton) and then you just set the properties of the link button. But how do you do it if there are multiple buttons for the data in the datafield. Do you extend the LinkButton or list data in a customitemrenderer class? How?
Re: [flexcoders] Re: DataGrid itemRenderer Woes
Hi Max, Finally got around to looking at you example and it looks great. I am gonna start building a work example for my app with some of your logic today so thanks and I will feedback the results. One things I noticed with your app is something that happens on some test I have run. Within the renderer that extends CheckBox did you notice the random check box in the top left of the first row in the grid completely out of place? I cannot yet work out why this happens but know that it occurs during visibility being toggled within the renderer itself? Odd, don't know if its down to our logic or a bug, seems buggy but we shall see :) Cheers, Simon On 26 Nov 2008, at 20:42, max.nachlinger wrote: I attacked this problem by focusing on keeping all the check-boxes correctly selected during a wild scroll up or down. Here's a href=http://home.comcast.net/~max.nachlinger/dgCheckboxScroll/;my solution/a, I hope it helps. --Max --- In flexcoders@yahoogroups.com, Simon Bailey [EMAIL PROTECTED] wrote: Fair enough, thanks for the feedback :) On 24 Nov 2008, at 15:49, Alex Harui wrote: The code you posted just sets visible=true/false which would likely set the entire renderer to visible/invisible and not some checkbox inside. If the code you showed is for a subclassed checkbox inside the renderer, then I'd make sure the .data is passed from the renderer to the subclassed checkbox. In cases like these, I usually extend DataGrid and add a function that dumps out the state of the renderers and their data items. Scroll until it goes bad, hit the button, call the function in the DG and see what it thinks is going on. -Alex From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com ] On Behalf Of Simon Bailey Sent: Sunday, November 23, 2008 11:44 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] DataGrid itemRenderer Woes Just a checkbox inside of it in answer to your first question. The reason I am using a column to ascertain visibility of the check box is due to using a vo to populate the header renderer and I need to make a comparison between the grid renderer current item and it corresponding column header vo. Cheers, Si On 24 Nov 2008, at 06:33, Alex Harui wrote: Are you changing the visibility of the entire renderer or just a checkbox inside it? Renderers on the recycle list get visible=false and set back to true when used again. If you completely hide a renderer, I'm not sure what would happen. Other than that, I would find a way to introspect the renderers and see if they did compute visible correctly for their data. It seems odd that your lookup of data.val is based on a column. From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com ] On Behalf Of Simon Bailey Sent: Sunday, November 23, 2008 11:24 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] DataGrid itemRenderer Woes Ok I have stopped all the errors and essentially integrated your (Alex's) logic into my application after some serious hair pulling. The responsibility lies now with the method below for showing or hiding the check box: override protected function commitProperties():void { super.commitProperties(); var row:int = listData.rowIndex+1; visible = false; for( var i:int = 0; i data.ff.length; i++ ) { if( data.val[listData.columnIndex-1] != undefined data.val[listData.columnIndex-1].option[i] == row ) { visible = true; } } if (owner is ListBase) selected = ListBase(owner).isItemSelected(data); } And dammit if its still doing exactly the same as before?!? On 23 Nov 2008, at 04:48, Alex Harui wrote: Read the item renderers section on my blog (blogs.adobe.com/ aharui). Start with the oldest posting. From: /spanflexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com ] On Behalf Of Simon Bailey Sent: Saturday, November 22, 2008 2:37 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] DataGrid itemRenderer Woes Hi, I have seen through google that this has been an issue but implementing various solutions still l! eaves my existing problem. Essentially I have a DataGrid with a custom itemRenderer displaying CheckBoxes. Within the renderer I am running a comparison on a value within the renderers data i.e. data.my_val and the current grid row and column values. Depending on whether the data value equals a specific row I show or hide the check box. I achieve this by running the comparison logic with the overridden updateDisplayList method below which works fine until scrolled. override protected function updateDisplayList( unscaledWidth:Number, unscaledHeight:Number ):void { super.updateDisplayList( unscaledWidth,
[flexcoders] Re: DataGrid itemRenderer Woes
I attacked this problem by focusing on keeping all the check-boxes correctly selected during a wild scroll up or down. Here's a href=http://home.comcast.net/~max.nachlinger/dgCheckboxScroll/;my solution/a, I hope it helps. --Max --- In flexcoders@yahoogroups.com, Simon Bailey [EMAIL PROTECTED] wrote: Fair enough, thanks for the feedback :) On 24 Nov 2008, at 15:49, Alex Harui wrote: The code you posted just sets visible=true/false which would likely set the entire renderer to visible/invisible and not some checkbox inside. If the code you showed is for a subclassed checkbox inside the renderer, then I'd make sure the .data is passed from the renderer to the subclassed checkbox. In cases like these, I usually extend DataGrid and add a function that dumps out the state of the renderers and their data items. Scroll until it goes bad, hit the button, call the function in the DG and see what it thinks is going on. -Alex From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Simon Bailey Sent: Sunday, November 23, 2008 11:44 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] DataGrid itemRenderer Woes Just a checkbox inside of it in answer to your first question. The reason I am using a column to ascertain visibility of the check box is due to using a vo to populate the header renderer and I need to make a comparison between the grid renderer current item and it corresponding column header vo. Cheers, Si On 24 Nov 2008, at 06:33, Alex Harui wrote: Are you changing the visibility of the entire renderer or just a checkbox inside it? Renderers on the recycle list get visible=false and set back to true when used again. If you completely hide a renderer, I'm not sure what would happen. Other than that, I would find a way to introspect the renderers and see if they did compute visible correctly for their data. It seems odd that your lookup of data.val is based on a column. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Simon Bailey Sent: Sunday, November 23, 2008 11:24 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] DataGrid itemRenderer Woes Ok I have stopped all the errors and essentially integrated your (Alex's) logic into my application after some serious hair pulling. The responsibility lies now with the method below for showing or hiding the check box: override protected function commitProperties():void { super.commitProperties(); var row:int = listData.rowIndex+1; visible = false; for( var i:int = 0; i data.ff.length; i++ ) { if( data.val[listData.columnIndex-1] != undefined data.val[listData.columnIndex-1].option[i] == row ) { visible = true; } } if (owner is ListBase) selected = ListBase(owner).isItemSelected(data); } And dammit if its still doing exactly the same as before?!? On 23 Nov 2008, at 04:48, Alex Harui wrote: Read the item renderers section on my blog (blogs.adobe.com/ aharui). Start with the oldest posting. From: /spanflexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com ] On Behalf Of Simon Bailey Sent: Saturday, November 22, 2008 2:37 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] DataGrid itemRenderer Woes Hi, I have seen through google that this has been an issue but implementing various solutions still l! eaves my existing problem. Essentially I have a DataGrid with a custom itemRenderer displaying CheckBoxes. Within the renderer I am running a comparison on a value within the renderers data i.e. data.my_val and the current grid row and column values. Depending on whether the data value equals a specific row I show or hide the check box. I achieve this by running the comparison logic with the overridden updateDisplayList method below which works fine until scrolled. override protected function updateDisplayList( unscaledWidth:Number, unscaledHeight:Number ):void { super.updateDisplayList( unscaledWidth, unscaledHeight ); var row:int = listData.rowIndex+1; for( var! i:int = 0; i data.ff.length; i++ ) { if( data.val[listData.columnIndex-1] != undefined data.val[listData.columnIndex-1].option[i] == row ) { btn.visible = true; } } } The issue is on scroll all of the check boxes are displayed/hidden incorrectly and the whole grid messes right up! Any ideas pls would be appreciated. Si
Re: [flexcoders] Re: DataGrid itemRenderer Woes
Max mate awesome, I will have a look right now. Peace S On 26 Nov 2008, at 20:42, max.nachlinger wrote: I attacked this problem by focusing on keeping all the check-boxes correctly selected during a wild scroll up or down. Here's a href=http://home.comcast.net/~max.nachlinger/dgCheckboxScroll/;my solution/a, I hope it helps. --Max --- In flexcoders@yahoogroups.com, Simon Bailey [EMAIL PROTECTED] wrote: Fair enough, thanks for the feedback :) On 24 Nov 2008, at 15:49, Alex Harui wrote: The code you posted just sets visible=true/false which would likely set the entire renderer to visible/invisible and not some checkbox inside. If the code you showed is for a subclassed checkbox inside the renderer, then I'd make sure the .data is passed from the renderer to the subclassed checkbox. In cases like these, I usually extend DataGrid and add a function that dumps out the state of the renderers and their data items. Scroll until it goes bad, hit the button, call the function in the DG and see what it thinks is going on. -Alex From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com ] On Behalf Of Simon Bailey Sent: Sunday, November 23, 2008 11:44 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] DataGrid itemRenderer Woes Just a checkbox inside of it in answer to your first question. The reason I am using a column to ascertain visibility of the check box is due to using a vo to populate the header renderer and I need to make a comparison between the grid renderer current item and it corresponding column header vo. Cheers, Si On 24 Nov 2008, at 06:33, Alex Harui wrote: Are you changing the visibility of the entire renderer or just a checkbox inside it? Renderers on the recycle list get visible=false and set back to true when used again. If you completely hide a renderer, I'm not sure what would happen. Other than that, I would find a way to introspect the renderers and see if they did compute visible correctly for their data. It seems odd that your lookup of data.val is based on a column. From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com ] On Behalf Of Simon Bailey Sent: Sunday, November 23, 2008 11:24 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] DataGrid itemRenderer Woes Ok I have stopped all the errors and essentially integrated your (Alex's) logic into my application after some serious hair pulling. The responsibility lies now with the method below for showing or hiding the check box: override protected function commitProperties():void { super.commitProperties(); var row:int = listData.rowIndex+1; visible = false; for( var i:int = 0; i data.ff.length; i++ ) { if( data.val[listData.columnIndex-1] != undefined data.val[listData.columnIndex-1].option[i] == row ) { visible = true; } } if (owner is ListBase) selected = ListBase(owner).isItemSelected(data); } And dammit if its still doing exactly the same as before?!? On 23 Nov 2008, at 04:48, Alex Harui wrote: Read the item renderers section on my blog (blogs.adobe.com/ aharui). Start with the oldest posting. From: /spanflexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com ] On Behalf Of Simon Bailey Sent: Saturday, November 22, 2008 2:37 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] DataGrid itemRenderer Woes Hi, I have seen through google that this has been an issue but implementing various solutions still l! eaves my existing problem. Essentially I have a DataGrid with a custom itemRenderer displaying CheckBoxes. Within the renderer I am running a comparison on a value within the renderers data i.e. data.my_val and the current grid row and column values. Depending on whether the data value equals a specific row I show or hide the check box. I achieve this by running the comparison logic with the overridden updateDisplayList method below which works fine until scrolled. override protected function updateDisplayList( unscaledWidth:Number, unscaledHeight:Number ):void { super.updateDisplayList( unscaledWidth, unscaledHeight ); var row:int = listData.rowIndex+1; for( var! i:int = 0; i data.ff.length; i++ ) { if( data.val[listData.columnIndex-1] != undefined data.val[listData.columnIndex-1].option[i] == row ) { btn.visible = true; } } } The issue is on scroll all of the check boxes are displayed/hidden incorrectly and the whole grid messes right up! Any ideas pls would be appreciated. Si
[flexcoders] Re: DataGrid itemRenderer Woes
That's quite a nasty bug. I created a checkbox renderer, traced traced listData.rowIndex, listData.columnIndex, and uid within overrides of set data(), set listData(), commitProperties(), and updateDisplayList and found that the DataGrid seemingly randomly changes (reuses?) the same uid for different listData.rowIndexes + listData.columnIndexes. I also tried trapping the change to rowIndex in set listData() and then doing some invalidating, but to no avail. Although this is a silly solution, one way out might be to put the rowIndex (or some other meaningful data) into the data itself when the dataProvider is assigned. The code below works on scroll (but misses the requirement to use rowIndex). /** * My data provider look like this: * [{ id:0, name:Test Name 0}, { id:1, name:Test Name 1},{ id:2, name:Test Name 2} ... etc] */ override protected function updateDisplayList(w:Number, h:Number):void { super.updateDisplayList(w, h); visible = data['id'] 3 || data['id'] 10; }
Re: [flexcoders] Re: DataGrid itemRenderer Woes
Max buddy I am bleedin glad it ain't just me here I tell ya. I will give it a go! Cheers ;) On 23 Nov 2008, at 02:44, max.nachlinger wrote: That's quite a nasty bug. I created a checkbox renderer, traced traced listData.rowIndex, listData.columnIndex, and uid within overrides of set data(), set listData(), commitProperties(), and updateDisplayList and found that the DataGrid seemingly randomly changes (reuses?) the same uid for different listData.rowIndexes + listData.columnIndexes. I also tried trapping the change to rowIndex in set listData() and then doing some invalidating, but to no avail. Although this is a silly solution, one way out might be to put the rowIndex (or some other meaningful data) into the data itself when the dataProvider is assigned. The code below works on scroll (but misses the requirement to use rowIndex). /** * My data provider look like this: * [{ id:0, name:Test Name 0}, { id:1, name:Test Name 1},{ id:2, name:Test Name 2} ... etc] */ override protected function updateDisplayList(w:Number, h:Number):void { super.updateDisplayList(w, h); visible = data['id'] 3 || data['id'] 10; }
[flexcoders] Re: DataGrid ItemRenderer - Reuse with Parameters vs Cloning
--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: Maybe you can use one of the examples on my blog? Or mine? http://flexdiary.blogspot.com/2008/09/extended-datagrid-with- stylefunction.html ;-) HTH; Amy
[flexcoders] Re: datagrid itemRenderer help
--- In flexcoders@yahoogroups.com, Tim Hoff [EMAIL PROTECTED] wrote: Ha, well we wouldn't want the inmates running the asylum. Props to Amy too. I'm just wondering why Adobe wouldn't already have these kinds of checks in place. I haven't looked at Label code specifically, but I see these kinds of checks in place all the time in the Framework code. If you just use a label without extending it (I didn't see anything in the logic to suggest why extending it was necessary), do you still get the error? If so, this should probably be filed as a bug. If not, it would be interesting to try to find out what the difference is. -Amy
[flexcoders] Re: datagrid itemRenderer help
by the way, I'm using RemoteObject to access my CFC, is it possible that the itemRenderer is firing before the data is back? How would I make the data populate the ArrayCollection fooAC first before rendering the datagrid? If this is the case anyways... On Mon, Oct 6, 2008 at 1:37 PM, Greg Morphis [EMAIL PROTECTED] wrote: I'm trying to use a dataGrid itemRenderer and not sure I'm using it right. I get an error 1009 null error on data.*any_column* My data is coming back fine from the database, the column I'm trying to reference is amount mx:DataGrid id=dg width=100% height=100% dataProvider={MyModel.getInstance().FooAC} click=clickHandler(event); dataTipFunction=buildToolTip mx:DataGridColumn dataField=amount headerText=Amount: textAlign=right headerStyleName=centered labelFunction=price_labelFunc sortCompareFunction=price_sortCompareFunc itemRenderer=com.renderers.PriceLabel / The PriceLabel.as file exists in foo.com.renderers and looks like : package com.renderers { import mx.controls.Label; import mx.controls.listClasses.*; import mx.controls.Alert; public class PriceLabel extends Label { override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); //Alert.show(data.toString()); } } } What am I doing wrong? Thanks
[flexcoders] Re: datagrid itemRenderer help
You might try adding this Greg: override public function set data( value : Object ) : void { if (value != null) super.data = value; } The data property will be null until the service call has returned and populated the collection. -TH --- In flexcoders@yahoogroups.com, Greg Morphis [EMAIL PROTECTED] wrote: by the way, I'm using RemoteObject to access my CFC, is it possible that the itemRenderer is firing before the data is back? How would I make the data populate the ArrayCollection fooAC first before rendering the datagrid? If this is the case anyways... On Mon, Oct 6, 2008 at 1:37 PM, Greg Morphis [EMAIL PROTECTED] wrote: I'm trying to use a dataGrid itemRenderer and not sure I'm using it right. I get an error 1009 null error on data.*any_column* My data is coming back fine from the database, the column I'm trying to reference is amount mx:DataGrid id=dg width=100% height=100% dataProvider={MyModel.getInstance().FooAC} click=clickHandler(event); dataTipFunction=buildToolTip mx:DataGridColumn dataField=amount headerText=Amount: textAlign=right headerStyleName=centered labelFunction=price_labelFunc sortCompareFunction=price_sortCompareFunc itemRenderer=com.renderers.PriceLabel / The PriceLabel.as file exists in foo.com.renderers and looks like : package com.renderers { import mx.controls.Label; import mx.controls.listClasses.*; import mx.controls.Alert; public class PriceLabel extends Label { override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); //Alert.show(data.toString()); } } } What am I doing wrong? Thanks
[flexcoders] Re: datagrid itemRenderer help
--- In flexcoders@yahoogroups.com, Tim Hoff [EMAIL PROTECTED] wrote: You might try adding this Greg: override public function set data( value : Object ) : void { if (value != null) super.data = value; } The data property will be null until the service call has returned and populated the collection. Label already implements IDropInListItemRenderer and IDataRenderer. Presumably correctly...
[flexcoders] Re: datagrid itemRenderer help
Correct. Perhaps the collection isn't bound to the dataProvider correctly. -TH --- In flexcoders@yahoogroups.com, Amy [EMAIL PROTECTED] wrote: --- In flexcoders@yahoogroups.com, Tim Hoff TimHoff@ wrote: You might try adding this Greg: override public function set data( value : Object ) : void { if (value != null) super.data = value; } The data property will be null until the service call has returned and populated the collection. Label already implements IDropInListItemRenderer and IDataRenderer. Presumably correctly...
Re: [flexcoders] Re: datagrid itemRenderer help
What do you mean? The collection shows in the dataGrid just fine, it's the custom itemRenderer that isn't working? Is there something else I can provide to check this? Thanks On Mon, Oct 6, 2008 at 4:20 PM, Tim Hoff [EMAIL PROTECTED] wrote: Correct. Perhaps the collection isn't bound to the dataProvider correctly. -TH --- In flexcoders@yahoogroups.com, Amy [EMAIL PROTECTED] wrote: --- In flexcoders@yahoogroups.com, Tim Hoff TimHoff@ wrote: You might try adding this Greg: override public function set data( value : Object ) : void { if (value != null) super.data = value; } The data property will be null until the service call has returned and populated the collection. Label already implements IDropInListItemRenderer and IDataRenderer. Presumably correctly... -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
Re: [flexcoders] Re: datagrid itemRenderer help
I changed the PriceLabel.as file to this.. package com.renderers { import mx.controls.Label; import mx.controls.listClasses.*; import mx.controls.Alert; public class PriceLabel extends Label { override public function set data( value : Object ) : void { if (value != null) super.data = value; } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { //super.updateDisplayList(unscaledWidth, unscaledHeight); //Alert.show(data.toString()); } } } I added a breakpoint after the commented out alert and still this.data shows null... Any other ideas? I'm out of them On Mon, Oct 6, 2008 at 4:23 PM, Greg Morphis [EMAIL PROTECTED] wrote: What do you mean? The collection shows in the dataGrid just fine, it's the custom itemRenderer that isn't working? Is there something else I can provide to check this? Thanks On Mon, Oct 6, 2008 at 4:20 PM, Tim Hoff [EMAIL PROTECTED] wrote: Correct. Perhaps the collection isn't bound to the dataProvider correctly. -TH --- In flexcoders@yahoogroups.com, Amy [EMAIL PROTECTED] wrote: --- In flexcoders@yahoogroups.com, Tim Hoff TimHoff@ wrote: You might try adding this Greg: override public function set data( value : Object ) : void { if (value != null) super.data = value; } The data property will be null until the service call has returned and populated the collection. Label already implements IDropInListItemRenderer and IDataRenderer. Presumably correctly... -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
[flexcoders] Re: datagrid itemRenderer help
data is probably null the first time that updateDisplayList is called. You can either put your conditional logic in the commitProperties() or set data() methods. Override public function set data( value : Object ) : void { if (value != null) { super.data = value; this.text = data.myField; // might want to debug this line to see the data { } -TH --- In flexcoders@yahoogroups.com, Greg Morphis [EMAIL PROTECTED] wrote: I changed the PriceLabel.as file to this.. package com.renderers { import mx.controls.Label; import mx.controls.listClasses.*; import mx.controls.Alert; public class PriceLabel extends Label { override public function set data( value : Object ) : void { if (value != null) super.data = value; } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { //super.updateDisplayList(unscaledWidth, unscaledHeight); //Alert.show(data.toString()); } } } I added a breakpoint after the commented out alert and still this.data shows null... Any other ideas? I'm out of them On Mon, Oct 6, 2008 at 4:23 PM, Greg Morphis [EMAIL PROTECTED] wrote: What do you mean? The collection shows in the dataGrid just fine, it's the custom itemRenderer that isn't working? Is there something else I can provide to check this? Thanks On Mon, Oct 6, 2008 at 4:20 PM, Tim Hoff [EMAIL PROTECTED] wrote: Correct. Perhaps the collection isn't bound to the dataProvider correctly. -TH --- In flexcoders@yahoogroups.com, Amy amyblankenship@ wrote: --- In flexcoders@yahoogroups.com, Tim Hoff TimHoff@ wrote: You might try adding this Greg: override public function set data( value : Object ) : void { if (value != null) super.data = value; } The data property will be null until the service call has returned and populated the collection. Label already implements IDropInListItemRenderer and IDataRenderer. Presumably correctly... -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-\ 1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
Re: [flexcoders] Re: datagrid itemRenderer help
Tim, you nailed it.. so set data keeps running until datagrid is full? I have to read up on this tonight.. but you saved my sanity! Thanks! On Mon, Oct 6, 2008 at 4:39 PM, Tim Hoff [EMAIL PROTECTED] wrote: data is probably null the first time that updateDisplayList is called. You can either put your conditional logic in the commitProperties() or set data() methods. Override public function set data( value : Object ) : void { if (value != null) { super.data = value; this.text = data.myField; // might want to debug this line to see the data { } -TH --- In flexcoders@yahoogroups.com, Greg Morphis [EMAIL PROTECTED] wrote: I changed the PriceLabel.as file to this.. package com.renderers { import mx.controls.Label; import mx.controls.listClasses.*; import mx.controls.Alert; public class PriceLabel extends Label { override public function set data( value : Object ) : void { if (value != null) super.data = value; } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { //super.updateDisplayList(unscaledWidth, unscaledHeight); //Alert.show(data.toString()); } } } I added a breakpoint after the commented out alert and still this.data shows null... Any other ideas? I'm out of them On Mon, Oct 6, 2008 at 4:23 PM, Greg Morphis [EMAIL PROTECTED] wrote: What do you mean? The collection shows in the dataGrid just fine, it's the custom itemRenderer that isn't working? Is there something else I can provide to check this? Thanks On Mon, Oct 6, 2008 at 4:20 PM, Tim Hoff [EMAIL PROTECTED] wrote: Correct. Perhaps the collection isn't bound to the dataProvider correctly. -TH --- In flexcoders@yahoogroups.com, Amy amyblankenship@ wrote: --- In flexcoders@yahoogroups.com, Tim Hoff TimHoff@ wrote: You might try adding this Greg: override public function set data( value : Object ) : void { if (value != null) super.data = value; } The data property will be null until the service call has returned and populated the collection. Label already implements IDropInListItemRenderer and IDataRenderer. Presumably correctly... -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
[flexcoders] Re: datagrid itemRenderer help
Ha, well we wouldn't want the inmates running the asylum. Props to Amy too. -TH --- In flexcoders@yahoogroups.com, Greg Morphis [EMAIL PROTECTED] wrote: Tim, you nailed it.. so set data keeps running until datagrid is full? I have to read up on this tonight.. but you saved my sanity! Thanks! On Mon, Oct 6, 2008 at 4:39 PM, Tim Hoff [EMAIL PROTECTED] wrote: data is probably null the first time that updateDisplayList is called. You can either put your conditional logic in the commitProperties() or set data() methods. Override public function set data( value : Object ) : void { if (value != null) { super.data = value; this.text = data.myField; // might want to debug this line to see the data { } -TH --- In flexcoders@yahoogroups.com, Greg Morphis gmorphis@ wrote: I changed the PriceLabel.as file to this.. package com.renderers { import mx.controls.Label; import mx.controls.listClasses.*; import mx.controls.Alert; public class PriceLabel extends Label { override public function set data( value : Object ) : void { if (value != null) super.data = value; } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { //super.updateDisplayList(unscaledWidth, unscaledHeight); //Alert.show(data.toString()); } } } I added a breakpoint after the commented out alert and still this.data shows null... Any other ideas? I'm out of them On Mon, Oct 6, 2008 at 4:23 PM, Greg Morphis gmorphis@ wrote: What do you mean? The collection shows in the dataGrid just fine, it's the custom itemRenderer that isn't working? Is there something else I can provide to check this? Thanks On Mon, Oct 6, 2008 at 4:20 PM, Tim Hoff TimHoff@ wrote: Correct. Perhaps the collection isn't bound to the dataProvider correctly. -TH --- In flexcoders@yahoogroups.com, Amy amyblankenship@ wrote: --- In flexcoders@yahoogroups.com, Tim Hoff TimHoff@ wrote: You might try adding this Greg: override public function set data( value : Object ) : void { if (value != null) super.data = value; } The data property will be null until the service call has returned and populated the collection. Label already implements IDropInListItemRenderer and IDataRenderer. Presumably correctly... -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-\ 1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
[flexcoders] Re: datagrid, itemrenderer images and events, . looking for a solution
Thanks Alex. That worked like a charm. --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: ITEM_ROLL_OVER event? From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Sanjay Hora Sent: Monday, September 08, 2008 11:01 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] datagrid, itemrenderer images and events, . looking for a solution Hi, My custom itemRenderer shows an image in the first column of my datagrid when mouseover happens. I need to know the index of the underlying data (basically image on which row was clicked) when the image is clicked but I am not sure how to get it. Is there any way to do it without making the end user click on the column of the grid itself. I know it is possible because I have seen an example somewhere. I really appreciate any help. cheers, sanjay
[flexcoders] Re: DataGrid itemRenderer current row and column
Well i found out myself thanks to Peter Ent see http://weblogs.macromedia.com/pent/archives/2008/03/itemrenderers_p_2.html --- In flexcoders@yahoogroups.com, robin bakkerus [EMAIL PROTECTED] wrote: Hi there, if you have a (generic) item renderer like this: mx:DataGridColumn dataField=aField headerText=Header editorDataField=data editable=true itemRenderer=myRenderer.GridField / And you use the same renderer on multiple fields, how then can you find out (in the GridField itemrenderer) what column is active ? thank you in advance
[flexcoders] Re: DataGrid itemRenderer and Loader Class
Thanks for your response. If Image is used as a renderer, would it load the image pointed to by the URL? If the image is already loaded by loader class (for a different purpose and is available in a local cache), would this not be redundant load? -nj --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: If your data objects contain an imageAttr field that is a URL, you can use Image as your renderer. You shouldn't need to fool around with the image.data or setting the image into your dataArray. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of natjai Sent: Friday, April 11, 2008 11:29 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] DataGrid itemRenderer and Loader Class Hello, I am new to flex, i apologize if this questions seems out of context. I have an image loaded with the Loader class in actionscript (say in a variable loader) I need to display this image onto a DataGrid Cell. Can i use a drop-in itemRenderer of Image class? Assuming the dataGrid has been set with a dataprovider dataArray[rows][columns], And the specified (dynamic) dataColumn in question is set dataGridColumn.dataField = imageAttr Could i do something like var image:Image = new Image(); image.data = Bitmap(loader).bitmapData dataArray[row][imageAttr] = image If this is not possible and i need to write a customRenderer, can you please guide me with a sample? thanks, -nj
[flexcoders] Re: DataGrid-itemRenderer-NumericStepper-sending data question
Its outside the DataGrid.
[flexcoders] Re: DataGrid-itemRenderer-NumericStepper-sending data question
Its outside the datagrid.
RE: [flexcoders] RE: DataGrid ItemRenderer
editable=true From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Manu Dhanda Sent: Friday, September 28, 2007 1:15 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] RE: DataGrid ItemRenderer My code is like this now, but am not getting any call to my eventhandler method while am making any changes to the inline comboboxes in datagrid. mx:DataGrid id=resultsDG dataProvider={newUserList} itemEditEnd=notifyChanges(event) mx:columns mx:DataGridColumn dataField=CoreId headerText=Core Id/ mx:DataGridColumn dataField=FirstName headerText=First Name/ mx:DataGridColumn dataField=LastName headerText=Last Name/ mx:DataGridColumn dataField=ManagerId headerText=Manager CoreId/ mx:DataGridColumn dataField=OffCode headerText=Location/ mx:DataGridColumn dataField=UserLevel headerText=User Level editable=true editorDataField=selectedItem mx:itemRenderer mx:Component comp:ComboBox selectedValue={data.UserLevel} mx:Array mx:Object data=Normal label=Normal / mx:Object data=Super label=Super / /mx:Array /comp:ComboBox /mx:Component /mx:itemRenderer /mx:DataGridColumn mx:DataGridColumn dataField=DataAdmin headerText=Data Admin mx:itemRenderer mx:Component comp:ComboBox selectedValue={data.DataAdmin} mx:Array mx:Object data=false label=No / mx:Object data=true label=Yes / /mx:Array /comp:ComboBox /mx:Component /mx:itemRenderer /mx:DataGridColumn mx:DataGridColumn dataField=UserStatus headerText=User Status/ mx:DataGridColumn dataField=Tool headerText=Tool/ /mx:columns /mx:DataGrid Anything that you can help with?? Am lost somewhere I guess.. Manu. Alex Harui wrote: Keep track in an itemEditEnd handler of which items need to be updated From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of Manu Dhanda Sent: Thursday, September 27, 2007 1:13 AM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: [flexcoders] DataGrid ItemRenderer Hii All, I have a datagrid populated with a list of users. Also, am using in-place item renderer for two columns. What I want to do is: Let the admin modify the various details of any number of users(multiple rows). After updating/changing the details, on the click of Update button, I want to identify, who all those user's are(user Id's), whose details has been modified in the datagrid, so that I could update the details for modified users only in the database. Following is the code: mx:DataGrid id=usersDG dataProvider={newUserList} width=100% mx:columns mx:DataGridColumn dataField=Id headerText=Id/ mx:DataGridColumn dataField=FirstName headerText=First Name/ mx:DataGridColumn dataField=LastName headerText=Last Name/ mx:DataGridColumn dataField=UserLevel headerText=User Level mx:itemRenderer mx:Component comp:ComboBox selectedValue={data.UserLevel} mx:Array mx:Object data=Normal label=Normal / mx:Object data=Super label=Super / /mx:Array /comp:ComboBox /mx:Component /mx:itemRenderer /mx:DataGridColumn mx:DataGridColumn dataField=DataAdmin headerText=Data Admin mx:itemRenderer mx:Component comp:ComboBox selectedValue={data.DataAdmin} mx:Array mx:Object data=false label=No / mx:Object data=true label=Yes / /mx:Array /comp:ComboBox /mx:Component /mx:itemRenderer /mx:DataGridColumn mx:DataGridColumn dataField=UserStatus headerText=User Status/ mx:DataGridColumn dataField=Tool headerText=Tool/ /mx:columns /mx:DataGrid Thanks, Manu. -- View this message in context: http://www.nabble.com/DataGrid-ItemRenderer-tf4527011.html#a12916787 http://www.nabble.com/DataGrid-ItemRenderer-tf4527011.html#a12916787 http://www.nabble.com/DataGrid-ItemRenderer-tf4527011.html#a12916787 http://www.nabble.com/DataGrid-ItemRenderer-tf4527011.html#a12916787 Sent from the FlexCoders mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/DataGrid-ItemRenderer-tf4527011.html#a12936479 http://www.nabble.com/DataGrid-ItemRenderer-tf4527011.html#a12936479 Sent from the FlexCoders mailing list archive at Nabble.com.
[flexcoders] RE: DataGrid ItemRenderer
My code is like this now, but am not getting any call to my eventhandler method while am making any changes to the inline comboboxes in datagrid. mx:DataGrid id=resultsDG dataProvider={newUserList} itemEditEnd=notifyChanges(event) mx:columns mx:DataGridColumn dataField=CoreId headerText=Core Id/ mx:DataGridColumn dataField=FirstName headerText=First Name/ mx:DataGridColumn dataField=LastName headerText=Last Name/ mx:DataGridColumn dataField=ManagerId headerText=Manager CoreId/ mx:DataGridColumn dataField=OffCode headerText=Location/ mx:DataGridColumn dataField=UserLevel headerText=User Level editable=true editorDataField=selectedItem mx:itemRenderer mx:Component comp:ComboBox selectedValue={data.UserLevel} mx:Array mx:Object data=Normal label=Normal / mx:Object data=Super label=Super / /mx:Array /comp:ComboBox /mx:Component /mx:itemRenderer /mx:DataGridColumn mx:DataGridColumn dataField=DataAdmin headerText=Data Admin mx:itemRenderer mx:Component comp:ComboBox selectedValue={data.DataAdmin} mx:Array mx:Object data=false label=No / mx:Object data=true label=Yes / /mx:Array /comp:ComboBox /mx:Component /mx:itemRenderer /mx:DataGridColumn mx:DataGridColumn dataField=UserStatus headerText=User Status/ mx:DataGridColumn dataField=Tool headerText=Tool/ /mx:columns /mx:DataGrid Anything that you can help with?? Am lost somewhere I guess.. Manu. Alex Harui wrote: Keep track in an itemEditEnd handler of which items need to be updated From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Manu Dhanda Sent: Thursday, September 27, 2007 1:13 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] DataGrid ItemRenderer Hii All, I have a datagrid populated with a list of users. Also, am using in-place item renderer for two columns. What I want to do is: Let the admin modify the various details of any number of users(multiple rows). After updating/changing the details, on the click of Update button, I want to identify, who all those user's are(user Id's), whose details has been modified in the datagrid, so that I could update the details for modified users only in the database. Following is the code: mx:DataGrid id=usersDG dataProvider={newUserList} width=100% mx:columns mx:DataGridColumn dataField=Id headerText=Id/ mx:DataGridColumn dataField=FirstName headerText=First Name/ mx:DataGridColumn dataField=LastName headerText=Last Name/ mx:DataGridColumn dataField=UserLevel headerText=User Level mx:itemRenderer mx:Component comp:ComboBox selectedValue={data.UserLevel} mx:Array mx:Object data=Normal label=Normal / mx:Object data=Super label=Super / /mx:Array /comp:ComboBox /mx:Component /mx:itemRenderer /mx:DataGridColumn mx:DataGridColumn dataField=DataAdmin headerText=Data Admin mx:itemRenderer mx:Component comp:ComboBox selectedValue={data.DataAdmin} mx:Array mx:Object data=false label=No / mx:Object data=true label=Yes / /mx:Array /comp:ComboBox /mx:Component /mx:itemRenderer /mx:DataGridColumn mx:DataGridColumn dataField=UserStatus headerText=User Status/ mx:DataGridColumn dataField=Tool headerText=Tool/ /mx:columns /mx:DataGrid Thanks, Manu. -- View this message in context: http://www.nabble.com/DataGrid-ItemRenderer-tf4527011.html#a12916787 http://www.nabble.com/DataGrid-ItemRenderer-tf4527011.html#a12916787 Sent from the FlexCoders mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/DataGrid-ItemRenderer-tf4527011.html#a12936479 Sent from the FlexCoders mailing list archive at Nabble.com.
[flexcoders] Re: DataGrid itemRenderer
Awesome - works great. Thanks Alex - sometimes the biggest problem is figuring out that something like labelFunction exists. I read through the Flex help docs but must've somehow overlooked this. --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: read up on labelFunction From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of byte.sensei Sent: Wednesday, September 26, 2007 7:59 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] DataGrid itemRenderer I've been pulling my hair out trying to figure out the best way to format numbers in a DataGrid. I've got a dataProvider with fields used in the grids that are of type Number -- some are currency, some are integers, and some are numbers that need to be formatted to 1 decimal point. In other places in my application, I'm using a custom function to format numbers: public function format_number(num : Number, format : String) : String { var formatter : NumberFormatter = new NumberFormatter(); var str : String; switch (format) { case currency: formatter.precision = 2; formatter.useThousandsSeparator = true; str = $ + formatter.format(num); break; case percent: formatter.precision = 1; formatter.useThousandsSeparator = true; str = formatter.format(num*100) + %; break; case decimal2: formatter.precision = 2; formatter.useThousandsSeparator = false; str = formatter.format(num); break; case cuft: formatter.precision = 1; formatter.useThousandsSeparator = true; if (num 0) { num = 0 } str = formatter.format(num); break; default: str = String(num); break; } return str; } However, I can't figure out a way to utilize this function on my DataGrid columns. I've tried creating both inline and external itemRenderer components, but in both cases I don't see a way to inject the required Actionscript into the itemRenderer component -- I keep getting compile errors when I try to use an mx:Script block in the component. Anyone know of a way to make this work?
[flexcoders] Re: DataGrid - ItemRenderer BUG on scrolling.
Hi , thanks Troy, I alredy checked what u advise, unfortunately it didnt work, i'd like to think this is a bug from Flex API cuz u dont thing im doing anything wrong. The problem happens with any kind of renderers, custom renderers, inline renderers, im so frustrated, something like using and item renderer should be easy, or at least should work. Im still open to suggestions, if anyone knows the solution please tell me. thanks anyway.
[flexcoders] Re: DataGrid, itemRenderer, button with custom image resizing
Is your button class the itemRenderer ? Have you tried creating an itemRenderer that extends a container and includes your button as a child ? I think I have seen checkBox itemRenderers implemented in this manner. --- In flexcoders@yahoogroups.com, wdsnapper [EMAIL PROTECTED] wrote: Hello, I have a datagrid I use to represent a shopping cart. One of the columns will contain a button used for deleting an item from the cart. The button is skinned with a custom graphic. I have been able to get the button into the column. I did this by subclassing Button in ActionScript, assigning a style to it representing the up, down, and over skin, and am able to process clicks and perform the required functionality. The problem I have is that the icon stretches to fill the column. I want the icon for the button to remain fixed size and not stretch. I have tried everything I can think of and am clearly missing something. Does this sound like the correct implementation approach? If so, can someone give me a pointer for how to solve this issue? If not, can someone suggest a better implementation for the item renderer to achieve the same functionality. Thanks in advance.
[flexcoders] Re: DataGrid, itemRenderer, button with custom image resizing
Thank you. This solved my problem. Specifically, I changed my remove button renderer class from extending Button to a class that extended Canvas and then create the button in there and add the Button as a child as you suggested. Very simple and works perfectly. --- In flexcoders@yahoogroups.com, maury.sword [EMAIL PROTECTED] wrote: Is your button class the itemRenderer ? Have you tried creating an itemRenderer that extends a container and includes your button as a child ? I think I have seen checkBox itemRenderers implemented in this manner. --- In flexcoders@yahoogroups.com, wdsnapper bill@ wrote: Hello, I have a datagrid I use to represent a shopping cart. One of the columns will contain a button used for deleting an item from the cart. The button is skinned with a custom graphic. I have been able to get the button into the column. I did this by subclassing Button in ActionScript, assigning a style to it representing the up, down, and over skin, and am able to process clicks and perform the required functionality. The problem I have is that the icon stretches to fill the column. I want the icon for the button to remain fixed size and not stretch. I have tried everything I can think of and am clearly missing something. Does this sound like the correct implementation approach? If so, can someone give me a pointer for how to solve this issue? If not, can someone suggest a better implementation for the item renderer to achieve the same functionality. Thanks in advance.
[flexcoders] Re: DataGrid ItemRenderer erratic setStyle - Is this a bug?
Are you sure that is working OK? I had seen the example before, try sorting by the last column. I has the same problem ... --- In flexcoders@yahoogroups.com, Oriol Gual [EMAIL PROTECTED] wrote: Hi, I've found this examplehttp://www.iepl.net/DataGridItemRendererSample/DataGridItemRen dererSample.html(source view http://www.iepl.net/DataGridItemRendererSample/srcview/, see AccountBalanceItemRenderer.as) thanks to a prior post and it's working ok. I suppose there's a typo in your code, if not, maybe you should put the overridden function inside your class. Hope it helps, Oriol. 2006/8/18, Oriol Gual [EMAIL PROTECTED]: I'm having the same problem, with a different approach but the result is the same. Any one can help? Thanks, Oriol. 2006/8/18, Oscar [EMAIL PROTECTED]: I have a datagrid with an itemRenderer in one of the columns. The text in that column turns red if a condition is met. The example below shows what I mean. However, if you scroll the datagrid or resize the screen so that the DG needs to be redrawn, the itemRenderer applies the setStyle to the rows that now are where the original row was. If you keep scrolling the DG down and up, all the rows end up with the style applied to them, wheter or not they meet the criteris in the Itemrenderer. Is this a bug? or am I missing something here? --- ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute mx:Script ![CDATA[ [Bindable] public var myArray:Array =[{a:10,b:15, c: 21}, {a:5,b:1,c: 4},{a:10,b:15, c: 21}, {a:10,b:15, c: 2},{a:10,b:15, c: 2}, {a:10,b:15, c: 2}, {a:10,b:15, c: 2},{a:10,b:15, c: 2}, {a:10,b:15, c: 2}, {a:10,b:15, c: 2},{a:10,b:15, c: 2}, {a:10,b:15, c: 2}, {a:10,b:15, c: 2},{a:10,b:15, c: 2}, {a:10,b:15, c: 2} ]; ]] /mx:Script mx:DataGrid dataProvider={myArray} mx:columns mx:DataGridColumn headerText=A dataField=a/ mx:DataGridColumn headerText=B dataField=b/ mx:DataGridColumn headerText=C dataField=c itemRenderer=myRenderer/ /mx:columns /mx:DataGrid /mx:Application --- --myRenderer.as-- // ActionScript file package { import mx.controls.Text; public class myRenderer extends Text { public function myRenderer() { } override public function set data(value:Object):void { super.data = value; if (Number(this.text) Number(value.a)*2) this.setStyle(color,red); super.invalidateDisplayList(); } } } -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 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/
[flexcoders] Re: DataGrid ItemRenderer erratic setStyle - Is this a bug?
I was wondering how long it would take for someone to notice the querky sort behaviour. The example also acts strange when the StartDate column is sorted. However, when data comes from a backend, instead of hardcoded in the app, these types of problems don't seem to occur. -TH --- In flexcoders@yahoogroups.com, Oscar [EMAIL PROTECTED] wrote: Are you sure that is working OK? I had seen the example before, try sorting by the last column. I has the same problem ... --- In flexcoders@yahoogroups.com, Oriol Gual oriol.gual@ wrote: Hi, I've found this examplehttp://www.iepl.net/DataGridItemRendererSample/DataGridItemRe n dererSample.html(source view http://www.iepl.net/DataGridItemRendererSample/srcview/, see AccountBalanceItemRenderer.as) thanks to a prior post and it's working ok. I suppose there's a typo in your code, if not, maybe you should put the overridden function inside your class. Hope it helps, Oriol. 2006/8/18, Oriol Gual oriol.gual@: I'm having the same problem, with a different approach but the result is the same. Any one can help? Thanks, Oriol. 2006/8/18, Oscar ocortess@: I have a datagrid with an itemRenderer in one of the columns. The text in that column turns red if a condition is met. The example below shows what I mean. However, if you scroll the datagrid or resize the screen so that the DG needs to be redrawn, the itemRenderer applies the setStyle to the rows that now are where the original row was. If you keep scrolling the DG down and up, all the rows end up with the style applied to them, wheter or not they meet the criteris in the Itemrenderer. Is this a bug? or am I missing something here? --- ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute mx:Script ![CDATA[ [Bindable] public var myArray:Array = [{a:10,b:15, c: 21}, {a:5,b:1,c: 4},{a:10,b:15, c: 21}, {a:10,b:15, c: 2},{a:10,b:15, c: 2}, {a:10,b:15, c: 2}, {a:10,b:15, c: 2},{a:10,b:15, c: 2}, {a:10,b:15, c: 2}, {a:10,b:15, c: 2},{a:10,b:15, c: 2}, {a:10,b:15, c: 2}, {a:10,b:15, c: 2},{a:10,b:15, c: 2}, {a:10,b:15, c: 2} ]; ]] /mx:Script mx:DataGrid dataProvider={myArray} mx:columns mx:DataGridColumn headerText=A dataField=a/ mx:DataGridColumn headerText=B dataField=b/ mx:DataGridColumn headerText=C dataField=c itemRenderer=myRenderer/ /mx:columns /mx:DataGrid /mx:Application --- --myRenderer.as-- // ActionScript file package { import mx.controls.Text; public class myRenderer extends Text { public function myRenderer() { } override public function set data(value:Object):void { super.data = value; if (Number(this.text) Number(value.a)*2) this.setStyle(color,red); super.invalidateDisplayList(); } } } -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 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/
[flexcoders] Re: DataGrid ItemRenderer erratic setStyle - Is this a bug?
As I said, it also happens if you scroll. My original app is actually calling an HTTP Service, and I am having the same problem. --- In flexcoders@yahoogroups.com, Tim Hoff [EMAIL PROTECTED] wrote: I was wondering how long it would take for someone to notice the querky sort behaviour. The example also acts strange when the StartDate column is sorted. However, when data comes from a backend, instead of hardcoded in the app, these types of problems don't seem to occur. -TH --- In flexcoders@yahoogroups.com, Oscar oscar_cortes@ wrote: Are you sure that is working OK? I had seen the example before, try sorting by the last column. I has the same problem ... --- In flexcoders@yahoogroups.com, Oriol Gual oriol.gual@ wrote: Hi, I've found this examplehttp://www.iepl.net/DataGridItemRendererSample/DataGridItemRe n dererSample.html(source view http://www.iepl.net/DataGridItemRendererSample/srcview/, see AccountBalanceItemRenderer.as) thanks to a prior post and it's working ok. I suppose there's a typo in your code, if not, maybe you should put the overridden function inside your class. Hope it helps, Oriol. 2006/8/18, Oriol Gual oriol.gual@: I'm having the same problem, with a different approach but the result is the same. Any one can help? Thanks, Oriol. 2006/8/18, Oscar ocortess@: I have a datagrid with an itemRenderer in one of the columns. The text in that column turns red if a condition is met. The example below shows what I mean. However, if you scroll the datagrid or resize the screen so that the DG needs to be redrawn, the itemRenderer applies the setStyle to the rows that now are where the original row was. If you keep scrolling the DG down and up, all the rows end up with the style applied to them, wheter or not they meet the criteris in the Itemrenderer. Is this a bug? or am I missing something here? --- ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute mx:Script ![CDATA[ [Bindable] public var myArray:Array = [{a:10,b:15, c: 21}, {a:5,b:1,c: 4},{a:10,b:15, c: 21}, {a:10,b:15, c: 2},{a:10,b:15, c: 2}, {a:10,b:15, c: 2}, {a:10,b:15, c: 2},{a:10,b:15, c: 2}, {a:10,b:15, c: 2}, {a:10,b:15, c: 2},{a:10,b:15, c: 2}, {a:10,b:15, c: 2}, {a:10,b:15, c: 2},{a:10,b:15, c: 2}, {a:10,b:15, c: 2} ]; ]] /mx:Script mx:DataGrid dataProvider={myArray} mx:columns mx:DataGridColumn headerText=A dataField=a/ mx:DataGridColumn headerText=B dataField=b/ mx:DataGridColumn headerText=C dataField=c itemRenderer=myRenderer/ /mx:columns /mx:DataGrid /mx:Application --- --myRenderer.as-- // ActionScript file package { import mx.controls.Text; public class myRenderer extends Text { public function myRenderer() { } override public function set data (value:Object):void { super.data = value; if (Number(this.text) Number(value.a)*2) this.setStyle(color,red); super.invalidateDisplayList(); } } } -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 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] Re: DataGrid ItemRenderer erratic setStyle - Is this a bug?
Yes, is working ok for me, I've tried sorting it on every column an scrolling, and there's no problem. I've only changed a few things, this is my itemRenderer code:package { import mx.controls.Text; public class VariacioItemRenderer extends Text { public function VariacioItemRenderer() { } override public function set data(value:Object):void { super.data = ""> if(value!=null) { if (value.variacio 0) { this.setStyle(color,red); } else { this.setStyle(color,green); } this.text = value.variacio + %; } super.invalidateDisplayList(); } } }2006/8/18, Oscar [EMAIL PROTECTED]: As I said, it also happens if you scroll. My original app isactually calling an HTTP Service, and I am having the same problem.--- In flexcoders@yahoogroups.com , Tim Hoff [EMAIL PROTECTED] wrote: I was wondering how long it would take for someone to notice the querky sort behaviour.The example also acts strange when the StartDate column is sorted.However, when data comes from a backend, instead of hardcoded in the app, these types of problems don't seem to occur. -TH --- In flexcoders@yahoogroups.com , Oscar oscar_cortes@ wrote: Are you sure that is working OK? I had seen the examplebefore, try sorting by the last column. I has the same problem ... --- In flexcoders@yahoogroups.com, Oriol Gual oriol.gual@ wrote: Hi, I've found this examplehttp://www.iepl.net/DataGridItemRendererSample/DataGridItemRe n dererSample.html (source view http://www.iepl.net/DataGridItemRendererSample/srcview/, see AccountBalanceItemRenderer.as ) thanks to a prior post and it's working ok. I suppose there's a typo in your code, if not, maybe you should put the overridden function inside your class. Hope it helps, Oriol. 2006/8/18, Oriol Gual oriol.gual@: I'm having the same problem, with a different approach but the result isthe same. Any one can help? Thanks, Oriol. 2006/8/18, Oscar ocortess@: I have a datagrid with an itemRenderer in one of the columns. The text in that column turns red if a condition is met. The example below shows what I mean. However, if you scroll thedatagrid or resize the screen so that the DG needs to be redrawn, the itemRenderer applies the setStyle to the rows that now are where the original row was. If you keep scrolling the DG down and up, all the rows end up with the style applied to them, wheter or not they meet the criteris in the Itemrenderer. Is this a bug? or am I missing something here? --- ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml layout=absolute mx:Script ![CDATA[ [Bindable] public var myArray:Array = [{a:10,b:15, c: 21}, {a:5,b:1,c: 4},{a:10,b:15, c: 21}, {a:10,b:15, c: 2},{a:10,b:15, c: 2}, {a:10,b:15, c: 2}, {a:10,b:15, c: 2},{a:10,b:15, c: 2}, {a:10,b:15, c: 2}, {a:10,b:15, c: 2},{a:10,b:15, c: 2}, {a:10,b:15, c: 2}, {a:10,b:15, c: 2},{a:10,b:15, c: 2}, {a:10,b:15, c: 2} ]; ]] /mx:Script mx:DataGrid dataProvider={myArray} mx:columns mx:DataGridColumn headerText=A dataField=a/ mx:DataGridColumn headerText=B dataField=b/ mx:DataGridColumn headerText=C dataField=c itemRenderer=myRenderer/ /mx:columns /mx:DataGrid /mx:Application --- --myRenderer.as-- // ActionScript file package { import mx.controls.Text; public class myRenderer extends Text {public function myRenderer() { } override public function set data (value:Object):void { super.data = "">if (Number(this.text) Number(value.a)*2) this.setStyle(color,red); super.invalidateDisplayList(); } } } -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links --Flexcoders Mailing ListFAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! 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/ __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Software development tool Software development Software development
[flexcoders] Re: DataGrid ItemRenderer erratic setStyle - Is this a bug?
Thanks Oriol, I made changes, similar to yours, to the sample. It fixed the problem. -TH View Sample--- In flexcoders@yahoogroups.com, "Oriol Gual" [EMAIL PROTECTED] wrote: Yes, is working ok for me, I've tried sorting it on every column an scrolling, and there's no problem. I've only changed a few things, this is my itemRenderer code: package { import mx.controls.Text; public class VariacioItemRenderer extends Text { public function VariacioItemRenderer() { } override public function set data(value:Object):void { super.data = ""> if(value!=null) { if (value.variacio 0) { this.setStyle("color","red"); } else { this.setStyle("color","green"); } this.text = value.variacio + "%"; } super.invalidateDisplayList(); } } } 2006/8/18, Oscar [EMAIL PROTECTED]:As I said, it also happens if you scroll. My original app is actually calling an HTTP Service, and I am having the same problem. --- In flexcoders@yahoogroups.com, "Tim Hoff" TimHoff@ wrote: I was wondering how long it would take for someone to notice the querky sort behaviour. The example also acts strange when the StartDate column is sorted. However, when data comes from a backend, instead of hardcoded in the app, these types of problems don't seem to occur. -TH --- In flexcoders@yahoogroups.com, "Oscar" oscar_cortes@ wrote: Are you sure that is working OK? I had seen the example before,try sorting by the last column. I has the same problem ... --- In flexcoders@yahoogroups.com, "Oriol Gual" oriol.gual@wrote: Hi, I've found this examplehttp://www.iepl.net/DataGridItemRendererSample/DataGridItemRe ndererSample.html(source view http://www.iepl.net/DataGridItemRendererSample/srcview/, see AccountBalanceItemRenderer.as) thanks to a prior post and it'sworking ok. I suppose there's a typo in your code, if not, maybe you should putthe overridden function inside your class. Hope it helps, Oriol. 2006/8/18, Oriol Gual oriol.gual@: I'm having the same problem, with a different approach but theresult is the same. Any one can help? Thanks, Oriol. 2006/8/18, Oscar ocortess@: I have a datagrid with an itemRenderer in one of the columns.The text in that column turns red if a condition is met. The example below shows what I mean. However, if you scroll the datagrid or resize the screen so that the DG needs to be redrawn, the itemRenderer applies the setStyle to the rows that now arewhere the original row was. If you keep scrolling the DG down and up, allthe rows end up with the style applied to them, wheter or not theymeet the criteris in the Itemrenderer. Is this a bug? or am I missing something here? --- ?xml version="1.0" encoding="utf-8"? mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" mx:Script ![CDATA[ [Bindable] public var myArray:Array = [{a:10,b:15,c: 21}, {a:5,b:1,c: 4},{a:10,b:15, c: 21}, {a:10,b:15, c: 2},{a:10,b:15, c: 2}, {a:10,b:15, c: 2}, {a:10,b:15, c: 2},{a:10,b:15, c: 2}, {a:10,b:15, c: 2}, {a:10,b:15, c: 2},{a:10,b:15, c: 2}, {a:10,b:15, c: 2}, {a:10,b:15, c: 2},{a:10,b:15, c: 2}, {a:10,b:15, c: 2} ]; ]] /mx:Script mx:DataGrid dataProvider="{myArray}" mx:columns mx:DataGridColumn headerText="A" dataField="a"/ mx:DataGridColumn headerText="B" dataField="b"/ mx:DataGridColumn headerText="C" dataField="c" itemRenderer="myRenderer"/ /mx:columns /mx:DataGrid /mx:Application --- --myRenderer.as-- // ActionScript file package { import mx.controls.Text; public class myRenderer extends Text { public function myRenderer() { } override public function set data (value:Object):void { super.data = ""> if (Number(this.text) Number(value.a)*2) this.setStyle("color","red"); super.invalidateDisplayList(); } } } -- Flexcoders Mailing List FAQ:http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives:
Re: [flexcoders] Re: DataGrid ItemRenderer
In case it helps anyone else, I've got this bullet thing working now. Three things were needed: - Setting the horizontal and vertical scroll policy as sinatosk suggested- Specifying the width, but not the height or the Text component. When you do this the text box will automatically adjust its height to show all the content - VariableRowHeight = true in the data grid component properties.mx:VBox verticalScrollPolicy=off horizontalScrollPolicy=off height=100% width=100% mx:Text text={data.description} fontWeight=bold width=380selectable=false/ mx:Text htmlText={data.detail} width=380selectable=false/ /mx:VBoxOn 8/1/06, ben.clinkinbeard [EMAIL PROTECTED] wrote: From what I was told in a previous thread, non-visible rows are not rendered. Basically, it renders however many rows are visible, and then when you scroll down for instance, it moves them all up one and moves the top row to the bottom and rerenders its content. Ben http://www.returnundefined.com/ __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
[flexcoders] Re: DataGrid ItemRenderer
From what I was told in a previous thread, non-visible rows are not rendered. Basically, it renders however many rows are visible, and then when you scroll down for instance, it moves them all up one and moves the top row to the bottom and rerenders its content. Ben http://www.returnundefined.com/ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 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/