Re: [flexcoders] Re: Datagrid question
It seems like the license number is not just a button label--it's actually a part of your model. Perhaps that column should render the number associated with each user (if any). If there's a number, display that. If it's NaN (or -1, or whatever invalid number you choose), display it as a 'Generate' button and on click, update the model with the number, and update the display of the renderer. -Original Message- From: Pilby i...@pilby.us Reply-to: flexcoders@yahoogroups.com To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Datagrid question Date: Mon, 20 Apr 2009 10:59:20 -0700 Thanks for responding, Tracy. Let's say this is an application that allows generation of license numbers. Imagine this: You have 3 columns in the datagrid. The first and second columns are the first and last names of a person. The third column is a button (which is really part of an MXML component) that has it's 'label' set as Click to generate license number. When the user clicks the button, the logic to generate the license number is within the component and will be output to the label property of the button, and the button will no longer be clickable. The application allows multiple people to be listed in the datagrid. Outside the datagrid, there is a button that says Click to print all. Given the specs I described so far, it's clear that I have to be able to iterate through each row in the datagrid, extracting the data from each column of each row. Typically, I would just get the dataProvider array collection object, and the problem would be solved. But because the license number is being output through the label property of the button (which is part of a MXML component) and is not part of the original dataProvider data, I can't go that route. I figured I now have to somehow iterate through each row, grabbing the data of each column of the row and storing it somehow. Is there a way for me to get the license number from the label property of the buttons?
RE: [flexcoders] Re: Datagrid question
.iterate through each row. You absolutely *cannot* do that, because all the DG rows do not exist, only the rows currently visible exist. You need to have your renderer update the dataProvider with the generated value, then iterate through the dataProvider. This should not be difficult. Tracy Spratt, Lariat Services, development services available _ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Pilby Sent: Monday, April 20, 2009 1:59 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Datagrid question Thanks for responding, Tracy. Let's say this is an application that allows generation of license numbers. Imagine this: You have 3 columns in the datagrid. The first and second columns are the first and last names of a person. The third column is a button (which is really part of an MXML component) that has it's 'label' set as Click to generate license number. When the user clicks the button, the logic to generate the license number is within the component and will be output to the label property of the button, and the button will no longer be clickable. The application allows multiple people to be listed in the datagrid. Outside the datagrid, there is a button that says Click to print all. Given the specs I described so far, it's clear that I have to be able to iterate through each row in the datagrid, extracting the data from each column of each row. Typically, I would just get the dataProvider array collection object, and the problem would be solved. But because the license number is being output through the label property of the button (which is part of a MXML component) and is not part of the original dataProvider data, I can't go that route. I figured I now have to somehow iterate through each row, grabbing the data of each column of the row and storing it somehow. Is there a way for me to get the license number from the label property of the buttons?
RE: [flexcoders] Re: Datagrid question
Yes, if every row is visible, then you could probably make this work. I think you need to use the DOM properties and methods, like DataGrid.numChildren() and getChildAt(). Sounds like a mess to me though. Tracy Spratt, Lariat Services, development services available _ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Pilby Sent: Monday, April 20, 2009 6:55 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Datagrid question .iterate through each row. You absolutely *cannot* do that, because all the DG rows do not exist, only the rows currently visible exist. You need to have your renderer update the dataProvider with the generated value, then iterate through the dataProvider. This should not be difficult. Tracy Spratt, I guess I would have to add an additional license field in my dataProvider, and I will just have my component itemrenderer put the data into that field, and I'd be able to iterate through my dataProvider to access the data. Okay, thank you for your advise on this, and this is all great and dandy. But please allow me to pick your brain a little more. Let's say my application still contained the same data format as described so far. But this time, my application is limited to a fixed 3 row x 3 column grid where everything is visible (and such, all are existent), is there a way to access the data without using the dataProvider? In other words, is there a way I can get a reference to each row, which presumably will be an array of columns, and then access the data similar to the way you would a two-dimensional array, keeping in mind that some of the cells can contain MXML components, and hence, require obtaining the reference of that MXML component in order to access its properties?
Re: [flexcoders] Re: DataGrid question
How do you override selectItem? ben.clinkinbeard [EMAIL PROTECTED] wrote: Subclass DataGrid and override selectItem, drawHighlightIndicator and drawSelectionIndicator so that they do nothing. --- In flexcoders@yahoogroups.com, djhatrick [EMAIL PROTECTED] wrote: I asked a while back and didn't see an example of how to override the method that selects an item in a datagrid, or for mouseovers for that reason. I am using a datagrid in an application, and it's a dummy datagrid just shows data - I don't want to select anything or highlight anything. Any help? Thanks, Patrick