Re: [flexcoders] Re: advanceddatagrid itemrenderer refering current column's data
Hey Alex could not find the background itemrenderer for ADG in your blog. Could you please send me the link? On Mon, Jul 14, 2008 at 6:09 PM, Vivian Richard <[EMAIL PROTECTED]> wrote: > > >Tel me try Amy, I will let you know. > >Alex I checked most of your examples most likely have seen >yours. I will try that one too an let you know my impression about it. > > > > > > On Mon, Jul 14, 2008 at 6:03 PM, Amy <[EMAIL PROTECTED]> wrote: > >> --- In flexcoders@yahoogroups.com , >> "Vivian Richard" <[EMAIL PROTECTED]> >> wrote: >> >> > >> > Hey Amy great getting an email from you. Man I guess you >> > paid google : every time I search anything regarding ADG you >> > blog pops up. :-) Thanks for taking time to share that with us. >> > >> > As I found all your examples are addressing the whole row, >> > I needed something for individual cells. I tried to work >> > with your code and put the itemrenderer in ADGColumn but >> > did not work accordingly. My requirement is very simple: all >> > my ADGColumn will have the same itemrenderer and if the >> > Column source has a nonempty string it will put the background >> > color else leave it as is. >> >> I actually didn't provide any examples, just talked about the general >> principles, unless you're talking about the posts that I linked to >> that didn't quite do what I wanted. >> >> The styleFunction will do whatever you tell it to, so you can very >> easily use that to style the columns based on the dataField that is a >> property of the object you get in the second parameter. >> >> So you could use something like this: >> >> private function styleMyRenderers(data:Object, >> col:AdvancedDataGridColumn){ >> if (data[col.dataField]=='foo'){ >> return {backgroundColor:0xFF};//red >> } >> return {backgroundColor:0x00FF00};//green >> } >> >> HTH; >> >> Amy >> >> >> > >
Re: [flexcoders] Re: advanceddatagrid itemrenderer refering current column's data
Tel me try Amy, I will let you know. Alex I checked most of your examples most likely have seen yours. I will try that one too an let you know my impression about it. On Mon, Jul 14, 2008 at 6:03 PM, Amy <[EMAIL PROTECTED]> wrote: > --- In flexcoders@yahoogroups.com , > "Vivian Richard" <[EMAIL PROTECTED]> > wrote: > > > > > Hey Amy great getting an email from you. Man I guess you > > paid google : every time I search anything regarding ADG you > > blog pops up. :-) Thanks for taking time to share that with us. > > > > As I found all your examples are addressing the whole row, > > I needed something for individual cells. I tried to work > > with your code and put the itemrenderer in ADGColumn but > > did not work accordingly. My requirement is very simple: all > > my ADGColumn will have the same itemrenderer and if the > > Column source has a nonempty string it will put the background > > color else leave it as is. > > I actually didn't provide any examples, just talked about the general > principles, unless you're talking about the posts that I linked to > that didn't quite do what I wanted. > > The styleFunction will do whatever you tell it to, so you can very > easily use that to style the columns based on the dataField that is a > property of the object you get in the second parameter. > > So you could use something like this: > > private function styleMyRenderers(data:Object, > col:AdvancedDataGridColumn){ > if (data[col.dataField]=='foo'){ > return {backgroundColor:0xFF};//red > } > return {backgroundColor:0x00FF00};//green > } > > HTH; > > Amy > > >
[flexcoders] Re: advanceddatagrid itemrenderer refering current column's data
--- In flexcoders@yahoogroups.com, "Alex Harui" <[EMAIL PROTECTED]> wrote: > > Has anyone tried the background item renderers from my blog in ADG? No, but I wound up subclassing from AdvancedDatagridGroupItemRenderer because the AdvancedDataGridItemRenderer couldn't be made to support alpha in the background but not the text. I suspect anyone wanting aplha transparency might have the same problem with the renderers on your site. Thanks; Amy
[flexcoders] Re: advanceddatagrid itemrenderer refering current column's data
--- In flexcoders@yahoogroups.com, "Vivian Richard" <[EMAIL PROTECTED]> wrote: > >Hey Amy great getting an email from you. Man I guess you >paid google : every time I search anything regarding ADG you >blog pops up. :-) Thanks for taking time to share that with us. > >As I found all your examples are addressing the whole row, >I needed something for individual cells. I tried to work >with your code and put the itemrenderer in ADGColumn but >did not work accordingly. My requirement is very simple: all >my ADGColumn will have the same itemrenderer and if the >Column source has a nonempty string it will put the background >color else leave it as is. I actually didn't provide any examples, just talked about the general principles, unless you're talking about the posts that I linked to that didn't quite do what I wanted. The styleFunction will do whatever you tell it to, so you can very easily use that to style the columns based on the dataField that is a property of the object you get in the second parameter. So you could use something like this: private function styleMyRenderers(data:Object, col:AdvancedDataGridColumn){ if (data[col.dataField]=='foo'){ return {backgroundColor:0xFF};//red } return {backgroundColor:0x00FF00};//green } HTH; Amy
RE: [flexcoders] Re: advanceddatagrid itemrenderer refering current column's data
Has anyone tried the background item renderers from my blog in ADG? From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Tracy Spratt Sent: Monday, July 14, 2008 5:59 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Re: advanceddatagrid itemrenderer refering current column's data Ohhh, yes, that is right, the default item render for ADG does not support a background color, sorry, I forgot that. So yeah, an item renderer looks like the way to go on that. Google this, surely someone has an example. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Vivian Richard Sent: Monday, July 14, 2008 8:42 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: advanceddatagrid itemrenderer refering current column's data Thanks for the response Tracy. By styling you are referring to the stylefunction? My understanding that that the stylefunction is only meant for the text not the background color. On Mon, Jul 14, 2008 at 5:04 PM, Tracy Spratt <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: The new styling in ADG might be a better way to do this. Tracy From: flexcoders@yahoogroups.com <mailto:flexcoders@yahoogroups.com> [mailto:flexcoders@yahoogroups.com <mailto:flexcoders@yahoogroups.com> ] On Behalf Of Vivian Richard Sent: Monday, July 14, 2008 7:42 PM To: flexcoders@yahoogroups.com <mailto:flexcoders@yahoogroups.com> Subject: Re: [flexcoders] Re: advanceddatagrid itemrenderer refering current column's data Hey Amy great getting an email from you. Man I guess you paid google : every time I search anything regarding ADG you blog pops up. :-) Thanks for taking time to share that with us. As I found all your examples are addressing the whole row, I needed something for individual cells. I tried to work with your code and put the itemrenderer in ADGColumn but did not work accordingly. My requirement is very simple: all my ADGColumn will have the same itemrenderer and if the Column source has a nonempty string it will put the background color else leave it as is. Regards On Mon, Jul 14, 2008 at 3:49 PM, Amy <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , "hworke" <[EMAIL PROTECTED]> wrote: > > > > Hi, in a advanceddatagrid I need to put same > background color if the the cell value is > not empty string. In the itemrenderer all I > need to check is if the current column value > is null or not. I know how to refer a value > of the data object in the itemrenderer like: > data.whateverParameter. But in this case I > need to refer the current column value not > a fixed parameter of the data object. How do > I refer to the current column vale in the > itemrenderer? > If you implement IDropInListRenderer, you can get access to the DataGridListData properties. Also, AdvancedDataGrid supports a style function, that you can use from outside the ADG to set styles. For more on that http://flexdiary.blogspot.com/2008/06/musings-on- <http://flexdiary.blogspot.com/2008/06/musings-on-> advanceddatagrid-part-1.html HTH; Amy
RE: [flexcoders] Re: advanceddatagrid itemrenderer refering current column's data
Ohhh, yes, that is right, the default item render for ADG does not support a background color, sorry, I forgot that. So yeah, an item renderer looks like the way to go on that. Google this, surely someone has an example. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Vivian Richard Sent: Monday, July 14, 2008 8:42 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: advanceddatagrid itemrenderer refering current column's data Thanks for the response Tracy. By styling you are referring to the stylefunction? My understanding that that the stylefunction is only meant for the text not the background color. On Mon, Jul 14, 2008 at 5:04 PM, Tracy Spratt <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: The new styling in ADG might be a better way to do this. Tracy From: flexcoders@yahoogroups.com <mailto:flexcoders@yahoogroups.com> [mailto:flexcoders@yahoogroups.com <mailto:flexcoders@yahoogroups.com> ] On Behalf Of Vivian Richard Sent: Monday, July 14, 2008 7:42 PM To: flexcoders@yahoogroups.com <mailto:flexcoders@yahoogroups.com> Subject: Re: [flexcoders] Re: advanceddatagrid itemrenderer refering current column's data Hey Amy great getting an email from you. Man I guess you paid google : every time I search anything regarding ADG you blog pops up. :-) Thanks for taking time to share that with us. As I found all your examples are addressing the whole row, I needed something for individual cells. I tried to work with your code and put the itemrenderer in ADGColumn but did not work accordingly. My requirement is very simple: all my ADGColumn will have the same itemrenderer and if the Column source has a nonempty string it will put the background color else leave it as is. Regards On Mon, Jul 14, 2008 at 3:49 PM, Amy <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , "hworke" <[EMAIL PROTECTED]> wrote: > > > > Hi, in a advanceddatagrid I need to put same > background color if the the cell value is > not empty string. In the itemrenderer all I > need to check is if the current column value > is null or not. I know how to refer a value > of the data object in the itemrenderer like: > data.whateverParameter. But in this case I > need to refer the current column value not > a fixed parameter of the data object. How do > I refer to the current column vale in the > itemrenderer? > If you implement IDropInListRenderer, you can get access to the DataGridListData properties. Also, AdvancedDataGrid supports a style function, that you can use from outside the ADG to set styles. For more on that http://flexdiary.blogspot.com/2008/06/musings-on- <http://flexdiary.blogspot.com/2008/06/musings-on-> advanceddatagrid-part-1.html HTH; Amy
Re: [flexcoders] Re: advanceddatagrid itemrenderer refering current column's data
Thanks for the response Tracy. By styling you are referring to the stylefunction? My understanding that that the stylefunction is only meant for the text not the background color. On Mon, Jul 14, 2008 at 5:04 PM, Tracy Spratt <[EMAIL PROTECTED]> wrote: >The new styling in ADG might be a better way to do this. > > Tracy > > > -- > > *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On > Behalf Of *Vivian Richard > *Sent:* Monday, July 14, 2008 7:42 PM > *To:* flexcoders@yahoogroups.com > *Subject:* Re: [flexcoders] Re: advanceddatagrid itemrenderer refering > current column's data > > > > > > >Hey Amy great getting an email from you. Man I guess you >paid google : every time I search anything regarding ADG you >blog pops up. :-) Thanks for taking time to share that with us. > >As I found all your examples are addressing the whole row, >I needed something for individual cells. I tried to work >with your code and put the itemrenderer in ADGColumn but >did not work accordingly. My requirement is very simple: all >my ADGColumn will have the same itemrenderer and if the >Column source has a nonempty string it will put the background >color else leave it as is. > >Regards > > > > On Mon, Jul 14, 2008 at 3:49 PM, Amy <[EMAIL PROTECTED]> > wrote: > > --- In flexcoders@yahoogroups.com , "hworke" > <[EMAIL PROTECTED]> wrote: > > > > > > > > Hi, in a advanceddatagrid I need to put same > > background color if the the cell value is > > not empty string. In the itemrenderer all I > > need to check is if the current column value > > is null or not. I know how to refer a value > > of the data object in the itemrenderer like: > > data.whateverParameter. But in this case I > > need to refer the current column value not > > a fixed parameter of the data object. How do > > I refer to the current column vale in the > > itemrenderer? > > > > If you implement IDropInListRenderer, you can get access to the > DataGridListData properties. Also, AdvancedDataGrid supports a style > function, that you can use from outside the ADG to set styles. For > more on that http://flexdiary.blogspot.com/2008/06/musings-on- > advanceddatagrid-part-1.html > > HTH; > > Amy > > > > >
RE: [flexcoders] Re: advanceddatagrid itemrenderer refering current column's data
The new styling in ADG might be a better way to do this. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Vivian Richard Sent: Monday, July 14, 2008 7:42 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: advanceddatagrid itemrenderer refering current column's data Hey Amy great getting an email from you. Man I guess you paid google : every time I search anything regarding ADG you blog pops up. :-) Thanks for taking time to share that with us. As I found all your examples are addressing the whole row, I needed something for individual cells. I tried to work with your code and put the itemrenderer in ADGColumn but did not work accordingly. My requirement is very simple: all my ADGColumn will have the same itemrenderer and if the Column source has a nonempty string it will put the background color else leave it as is. Regards On Mon, Jul 14, 2008 at 3:49 PM, Amy <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , "hworke" <[EMAIL PROTECTED]> wrote: > > > > Hi, in a advanceddatagrid I need to put same > background color if the the cell value is > not empty string. In the itemrenderer all I > need to check is if the current column value > is null or not. I know how to refer a value > of the data object in the itemrenderer like: > data.whateverParameter. But in this case I > need to refer the current column value not > a fixed parameter of the data object. How do > I refer to the current column vale in the > itemrenderer? > If you implement IDropInListRenderer, you can get access to the DataGridListData properties. Also, AdvancedDataGrid supports a style function, that you can use from outside the ADG to set styles. For more on that http://flexdiary.blogspot.com/2008/06/musings-on- <http://flexdiary.blogspot.com/2008/06/musings-on-> advanceddatagrid-part-1.html HTH; Amy
Re: [flexcoders] Re: advanceddatagrid itemrenderer refering current column's data
Hey Amy great getting an email from you. Man I guess you paid google : every time I search anything regarding ADG you blog pops up. :-) Thanks for taking time to share that with us. As I found all your examples are addressing the whole row, I needed something for individual cells. I tried to work with your code and put the itemrenderer in ADGColumn but did not work accordingly. My requirement is very simple: all my ADGColumn will have the same itemrenderer and if the Column source has a nonempty string it will put the background color else leave it as is. Regards On Mon, Jul 14, 2008 at 3:49 PM, Amy <[EMAIL PROTECTED]> wrote: > --- In flexcoders@yahoogroups.com , > "hworke" <[EMAIL PROTECTED]> wrote: > > > > > > > > Hi, in a advanceddatagrid I need to put same > > background color if the the cell value is > > not empty string. In the itemrenderer all I > > need to check is if the current column value > > is null or not. I know how to refer a value > > of the data object in the itemrenderer like: > > data.whateverParameter. But in this case I > > need to refer the current column value not > > a fixed parameter of the data object. How do > > I refer to the current column vale in the > > itemrenderer? > > > > If you implement IDropInListRenderer, you can get access to the > DataGridListData properties. Also, AdvancedDataGrid supports a style > function, that you can use from outside the ADG to set styles. For > more on that http://flexdiary.blogspot.com/2008/06/musings-on- > advanceddatagrid-part-1.html > > HTH; > > Amy > > >
[flexcoders] Re: advanceddatagrid itemrenderer refering current column's data
--- In flexcoders@yahoogroups.com, "hworke" <[EMAIL PROTECTED]> wrote: > > > > Hi, in a advanceddatagrid I need to put same > background color if the the cell value is > not empty string. In the itemrenderer all I > need to check is if the current column value > is null or not. I know how to refer a value > of the data object in the itemrenderer like: > data.whateverParameter. But in this case I > need to refer the current column value not > a fixed parameter of the data object. How do > I refer to the current column vale in the > itemrenderer? > If you implement IDropInListRenderer, you can get access to the DataGridListData properties. Also, AdvancedDataGrid supports a style function, that you can use from outside the ADG to set styles. For more on that http://flexdiary.blogspot.com/2008/06/musings-on- advanceddatagrid-part-1.html HTH; Amy
[flexcoders] Re: AdvancedDataGrid ItemRenderer
Tracy, Is it because creationComplete only happens once per visible row and the renderer is recycled on dg scroll, change, etc? What I desperately want to learn is how to know when to override a super's function - in this case updateDisplayList(). How would you know to do that verses invalidateList() or invalidateDisplayList()?? Is this learned by experience (such as how I am right now), or does one look at this code and intuitively know to override updateDisplayList? Does it become more apparent when you start disecting inherited classes? How is this learned? BTW, your input helped me arrive at a very elegant solution with native mxml - AdvancedDataGridRendererProvider: The depth is the key - where 1 would be the Group node and 2 would be the first indentation or sub-set of data under the grouping. Even though I found a solution, I am still very interested in your thoughts on the learning approach query above. Thanks to all, Jeff --- In flexcoders@yahoogroups.com, "Tracy Spratt" <[EMAIL PROTECTED]> wrote: > > And remove that logic from the creationComplete handler entirely. Do > you understand why? > > Tracy > > > > > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of gene_belor > Sent: Tuesday, June 10, 2008 10:58 AM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Re: AdvancedDataGrid ItemRenderer > > > > override updateDisplayList(..) function and set visibility there as > opposed to in set data(...). > > --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > , "securenetfreedom" nv1000@ wrote: > > > > I am using an ADG with HierarchicalData to group my data. I am using a > > checkbox item renderer that the user can check to archive the row. > > However, the checkbox is diplaying on every row and I need it to > > display only on the sub-set like below: > > > > Group | Archive | Title | > > Group1 > > --|-- chk --| Trains | > > --|-- chk --| Planes | > > Group2 > > --|-- chk --| Autos | > > > > I have tried setting the visibility of the Canvas (the base of the > > checkbox itemrenderer component) in the creationComplete handler and > > in the 'set data' method of the component which works on the first > > pass, but when scrolling the grid or expanding the nodes, results are > > inconsistent. > > > > private var _vis:Boolean; > > // called by creationComplete event > > public function init():void{ > > var nodeName:String = _listData["item"].name(); > > _vis = (nodeName == "item"); > > this.visible = _vis; > > } > > override public function set data(value:Object):void { > > super.data = value; > > chkbox.selected = (value[_dataField] == "true"); > > this.visible = _vis; > > } > > > > Thanks for your input. > > > > Jeff > > >
RE: [flexcoders] Re: AdvancedDataGrid ItemRenderer
And remove that logic from the creationComplete handler entirely. Do you understand why? Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of gene_belor Sent: Tuesday, June 10, 2008 10:58 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: AdvancedDataGrid ItemRenderer override updateDisplayList(..) function and set visibility there as opposed to in set data(...). --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , "securenetfreedom" <[EMAIL PROTECTED]> wrote: > > I am using an ADG with HierarchicalData to group my data. I am using a > checkbox item renderer that the user can check to archive the row. > However, the checkbox is diplaying on every row and I need it to > display only on the sub-set like below: > > Group | Archive | Title | > Group1 > --|-- chk --| Trains | > --|-- chk --| Planes | > Group2 > --|-- chk --| Autos | > > I have tried setting the visibility of the Canvas (the base of the > checkbox itemrenderer component) in the creationComplete handler and > in the 'set data' method of the component which works on the first > pass, but when scrolling the grid or expanding the nodes, results are > inconsistent. > > private var _vis:Boolean; > // called by creationComplete event > public function init():void{ > var nodeName:String = _listData["item"].name(); > _vis = (nodeName == "item"); > this.visible = _vis; > } > override public function set data(value:Object):void { > super.data = value; > chkbox.selected = (value[_dataField] == "true"); > this.visible = _vis; > } > > Thanks for your input. > > Jeff >
[flexcoders] Re: AdvancedDataGrid ItemRenderer
override updateDisplayList(..) function and set visibility there as opposed to in set data(...). --- In flexcoders@yahoogroups.com, "securenetfreedom" <[EMAIL PROTECTED]> wrote: > > I am using an ADG with HierarchicalData to group my data. I am using a > checkbox item renderer that the user can check to archive the row. > However, the checkbox is diplaying on every row and I need it to > display only on the sub-set like below: > > Group | Archive | Title | > Group1 > --|-- chk --| Trains | > --|-- chk --| Planes | > Group2 > --|-- chk --| Autos | > > I have tried setting the visibility of the Canvas (the base of the > checkbox itemrenderer component) in the creationComplete handler and > in the 'set data' method of the component which works on the first > pass, but when scrolling the grid or expanding the nodes, results are > inconsistent. > > private var _vis:Boolean; > // called by creationComplete event > public function init():void{ > var nodeName:String = _listData["item"].name(); > _vis = (nodeName == "item"); > this.visible = _vis; > } > override public function set data(value:Object):void { > super.data = value; > chkbox.selected = (value[_dataField] == "true"); > this.visible = _vis; > } > > Thanks for your input. > > Jeff >
[flexcoders] Re: AdvancedDataGrid & ItemRenderer
Scott, Thank you very much! I would never have figured that one out! Thanks for your help, it works wonderfully now. -Loc
Re: [flexcoders] Re: AdvancedDataGrid & ItemRenderer
You can find out what row they are dragging over using the information in the DragEvent... here is a snippet that may help. It is modified from my original code, but should get you most of the way home :) If there is an easier way to find the item i'd sure like to know... public function handleDragOver(event:DragEvent):void { var dropTargetItem:Object = null; var dropTarget:AdvancedDataGrid=AdvancedDataGrid(event.currentTarget); var dropIndex:int = dropTarget.calculateDropIndex(event); // Get drop target. var view:ICollectionView = ICollectionView(loadOutsGrid.dataProvider); if(dropIndex < view.length) { var cursor:IViewCursor = view.createCursor(); var x:int = 0; while(cursor.afterLast == false && x < dropIndex) { cursor.moveNext(); x++; } if(cursor.afterLast == false) { dropTargetItem = cursor.current; } } } hth Scott Scott Melby Founder, Fast Lane Software LLC http://www.fastlanesw.com loc_tran106 wrote: Scott, But for my application, i need to determine the target more so than the initiator. By specifying the event listener on the datagrid, i lose the ability to determine which row the user is specifying... Or am I wrong? Tnx, -L
[flexcoders] Re: AdvancedDataGrid & ItemRenderer
Scott, But for my application, i need to determine the target more so than the initiator. By specifying the event listener on the datagrid, i lose the ability to determine which row the user is specifying... Or am I wrong? Tnx, -L