Re: [flexcoders] JUST SAY NO to creationPolicy=all !
Couldn't agree more Gordon. Thanks for the rant and for posting this! | Aaron West | aaron AT trajiklyhip DOT com | http://www.trajiklyhip.com/blog/ | Certified Advanced Adobe ColdFusion MX 7 Developer | Certified Macromedia FlashMX Developer | Adobe Community Expert On Oct 30, 2006, at 3:47 PM, Gordon Smith wrote: x-tad-biggerrant>/x-tad-bigger x-tad-bigger /x-tad-bigger x-tad-biggerSeveral times a week someone complains that they can't seem to set data into controls on the second, third, etc. pane of a ViewStack, Accordion, or TabNavigator because these controls don't get created until the user navigates to the pane they're on./x-tad-bigger x-tad-bigger /x-tad-bigger x-tad-biggerInevitably there are multiple replies solving this problem by setting creationPolicy=all. Inevitably I reply that Adobe doesn't recommend doing this because it defeats the entire purpose of the deferred instantiation feature, which is to minimize startup time by not creating visual components until they need to be seen./x-tad-bigger x-tad-bigger /x-tad-bigger x-tad-biggerA much better technique is to use event handlers to get the appropriate data into the controls after they get created. For example, you can use the 'initialize' event on each pane, which won't get dispatched until after that pane's controls exist./x-tad-bigger x-tad-bigger /x-tad-bigger x-tad-bigger mx:Accordion>/x-tad-bigger x-tad-bigger mx:VBox initialize=textInput1.text='Hello'>/x-tad-bigger x-tad-bigger mx:TextInput id=textInput1/>/x-tad-bigger x-tad-bigger /mx:VBox>/x-tad-bigger x-tad-bigger mx:VBox initialize=textInput2.text='World'>/x-tad-bigger x-tad-bigger mx:TextInput id=textInput2/>/x-tad-bigger x-tad-bigger /mx:VBox>/x-tad-bigger x-tad-bigger /mx:Accordion>/x-tad-bigger x-tad-bigger /x-tad-bigger x-tad-biggerUsing databinding is another good technique. The bindings will occur after the controls get created./x-tad-bigger x-tad-bigger /x-tad-bigger x-tad-biggerI've never seen a case where it is necessary to push data into the controls before they exist. If you must put the data somewhere in the meantime, store it in data vars, which have none of the startup cost of a visual component, and then move it into the controls after they get created./x-tad-bigger x-tad-bigger /x-tad-bigger x-tad-bigger/rant>/x-tad-bigger x-tad-bigger /x-tad-bigger x-tad-bigger- Gordon, the Flex framework engineer who designed and implemented the deferred instantiation feature, so listen to me on this one!/x-tad-bigger x-tad-bigger /x-tad-bigger __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com image.tiff> SPONSORED LINKS Software development tool Software development Software development services Home design software Software development company x-tad-smaller Your email settings: Individual Email|Traditional/x-tad-smallerx-tad-smallerChange settings via the Web/x-tad-smallerx-tad-smaller (Yahoo! ID required) /x-tad-smallerx-tad-smaller Change settings via email: /x-tad-smallerx-tad-smallerSwitch delivery to Daily Digest/x-tad-smallerx-tad-smaller | /x-tad-smallerx-tad-smallerSwitch to Fully Featured/x-tad-smallerx-tad-smaller /x-tad-smallerx-tad-smaller Visit Your Group /x-tad-smallerx-tad-smaller /x-tad-smallerx-tad-smaller| /x-tad-smallerx-tad-smallerYahoo! Groups Terms of Use /x-tad-smallerx-tad-smaller /x-tad-smallerx-tad-smaller| /x-tad-smallerx-tad-smallerUnsubscribe /x-tad-smaller__,_._,___
Re: [flexcoders] Another DataGrid itemEditor ComboBox challenge
Good to know and thanks for posting. I wasn't aware of that keyword but there are others like parentDocument you can use in custom MXML components. And of course in custom components built using AS3 there's the Application.application.* reference available after importing mx.core.Application. | Aaron West | aaron AT trajiklyhip DOT com | http://www.trajiklyhip.com/blog/ | Certified Advanced Adobe ColdFusion MX 7 Developer | Certified Macromedia FlashMX Developer | Adobe Community Expert On Oct 18, 2006, at 11:39 PM, Iko Knyphausen wrote: Finally figured it out: It was a scope problem. mx:component> has its own scope which explains why nothing beyond your parents (editor host) “data” object is visible. If you want to use an inline itemEditor that is data bound to other dynamic sources than the hosting component’s dataProvider, such as an XML for example, you just use the “outerDocument” keyword as a prefix. The following is an example for an inline itemEditor combobox that gets its own data independently from the host (hope this helps someone to learn faster than me ;-) ) x-tad-bigger mx:Component id=inlineEditor>/x-tad-bigger x-tad-biggermx:ComboBox labelField=lastName dataProvider={/x-tad-biggerx-tad-biggerouterDocument/x-tad-biggerx-tad-bigger.userInfo.lastResult.users.user}/>/x-tad-bigger x-tad-bigger /mx:Component> /x-tad-bigger
[flexcoders] DataGrid Weirdness with Online Example
All, DataGrid's are cool, but yeash I've run into a lot of problems with them. I've put together two *real simple* online demonstrations that illustrate the behavior I'm seeing with a grid. I'd love for someone more experienced to check out these two examples and offer any insight or solution. http://www.trajiklyhip.com/flex/gridexample/DataGridExample1.html This is a simple grid that uses a custom Checkbox item renderer written in AS3. Clicking the submit button will display whether or not each Checkbox is selected. Make some changes to the boxes, de-selecting a few or an entire column and then click the submit button to see the selected value. The Alert box usually displays the right info the first time through, but after you've gone through a few rounds of selecting and de-selecting some of the boxes it will not show you the correct true/false value of each box. http://www.trajiklyhip.com/flex/gridexample/DataGridExample2.html This is another simple grid that is the same as the previous one only with more rows of data to make the DataGrid scroll. De-select the first Group Owner Checkbox (row 1 with the ID = 12) and then click use the grid scroll bar to scroll up and down. As you scroll, other Checkboxes are selected and deselected at random. Incidentally, if you right-click the DataGridExample1 movie you can view the source to see what I'm doing. | Aaron West | aaron AT trajiklyhip DOT com | http://www.trajiklyhip.com/blog/ | Certified Advanced Adobe ColdFusion MX 7 Developer | Certified Macromedia FlashMX Developer | Adobe Community Expert -- 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/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
Re: [flexcoders] DataGrid Weirdness with Online Example
iko, thanks for your response. I can't set the editable=false property on the grid columns because then they won't report back selections / deselections to the data provider (an ArrayCollection). Also, your second suggestion of manually setting the selected property is already being done in my custom AS3 renderer in the overriden clickHandler() function. | Aaron West | aaron AT trajiklyhip DOT com | http://www.trajiklyhip.com/blog/ | Certified Advanced Adobe ColdFusion MX 7 Developer | Certified Macromedia FlashMX Developer | Adobe Community Expert On Oct 19, 2006, at 2:09 PM, Iko Knyphausen wrote: Took a while to reproduce... which may trick you in believing its all ok. Try editable=”false” and set the selectedItem.field.selected property manually in a change event of the checkbox. - Iko x-tad-biggerFrom:/x-tad-biggerx-tad-bigger flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] /x-tad-biggerx-tad-biggerOn Behalf Of /x-tad-biggerx-tad-biggerAaron West/x-tad-bigger x-tad-biggerSent:/x-tad-biggerx-tad-bigger Thursday, October 19, 2006 9:48 AM/x-tad-bigger x-tad-biggerTo:/x-tad-biggerx-tad-bigger flexcoders@yahoogroups.com/x-tad-bigger x-tad-biggerSubject:/x-tad-biggerx-tad-bigger [flexcoders] DataGrid Weirdness with Online Example/x-tad-bigger All, DataGrid's are cool, but yeash I've run into a lot of problems with them. I've put together two *real simple* online demonstrations that illustrate the behavior I'm seeing with a grid. I'd love for someone more experienced to check out these two examples and offer any insight or solution. http://www.trajiklyhip.com/flex/gridexample/DataGridExample1.html This is a simple grid that uses a custom Checkbox item renderer written in AS3. Clicking the submit button will display whether or not each Checkbox is selected. Make some changes to the boxes, de-selecting a few or an entire column and then click the submit button to see the selected value. The Alert box usually displays the right info the first time through, but after you've gone through a few rounds of selecting and de-selecting some of the boxes it will not show you the correct true/false value of each box. http://www.trajiklyhip..com/flex/gridexample/DataGridExample2.html This is another simple grid that is the same as the previous one only with more rows of data to make the DataGrid scroll. De-select the first Group Owner Checkbox (row 1 with the ID = 12) and then click use the grid scroll bar to scroll up and down. As you scroll, other Checkboxes are selected and deselected at random. Incidentally, if you right-click the DataGridExample1 movie you can view the source to see what I'm doing. | Aaron West | aaron AT trajiklyhip DOT com | http://www.trajiklyhip.com/blog/ | Certified Advanced Adobe ColdFusion MX 7 Developer | Certified Macromedia FlashMX Developer | Adobe Community Expert __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: image.tiff> SPONSORED LINKS Software development tool Software development Software development services Home design software Software development company x-tad-smaller Your email settings: Individual Email|Traditional/x-tad-smallerx-tad-smallerChange settings via the Web/x-tad-smallerx-tad-smaller (Yahoo! ID required) /x-tad-smallerx-tad-smaller Change settings via email: /x-tad-smallerx-tad-smallerSwitch delivery to Daily Digest/x-tad-smallerx-tad-smaller | /x-tad-smallerx-tad-smallerSwitch to Fully Featured/x-tad-smallerx-tad-smaller /x-tad-smallerx-tad-smaller Visit Your Group /x-tad-smallerx-tad-smaller /x-tad-smallerx-tad-smaller| /x-tad-smallerx-tad-smallerYahoo! Groups Terms of Use /x-tad-smallerx-tad-smaller /x-tad-smallerx-tad-smaller| /x-tad-smallerx-tad-smallerUnsubscribe /x-tad-smaller__,_._,___
Re: [flexcoders] Disappearing list items
Douglas, out of curiosity how come you prefer to not send queries from CF to Flex? Also, what do you do instead? You mentioned converting the query record-set to an Array of Objects or XML. What benefits do you get on the Flex end for doing this considering its more work for CF? | Aaron West | aaron AT trajiklyhip DOT com | http://www.trajiklyhip.com/blog/ | Certified Advanced Adobe ColdFusion MX 7 Developer | Certified Macromedia FlashMX Developer | Adobe Community Expert On Oct 16, 2006, at 8:55 AM, Douglas Knudsen wrote: odd. Myself, I prefer not to return queries from CF to Flex. Instead convert to a array of objects or XML. That said, maybe try using the SQL for it direct, in case the Query functions are flaking somehow. The below would be for Oracle. cfquery name=qry2 dbtype=query> SELECT TABLKEY, TABLFLD FROM application.udf.getalldropdowns WHERE TABLID = '010' UNION SELECT '' AS TABLKEY, '' AS TABLFLD FROM dual ORDER BY TABLFLD /cfquery> DK On 10/16/06, Rick Root [EMAIL PROTECTED]> wrote:so, I solved this problem. My data provider was a query returned by a remoting call created like this: cfquery name=qry2 dbtype=query> SELECT TABLKEY, TABLFLD FROM application.udf.getalldropdowns WHERE TABLID = '010' ORDER BY TABLFLD /cfquery> cfset queryaddrow(qry2,1)> cfset querysetcell(qry2,TABLKEY,)> cfset querysetcell(qry2,TABLFLD,)> cfquery name=qry dbtype=query> SELECT * FROM qry2 ORDER BY TABLFLD /cfquery> cfset retval.COUNTRIES = qry> I did it this way so I could always have a blank item in the dropdown The solution was to change the second querysetcell line to be the following: cfset querysetcell(qry2,TABLFLD,- not selected -)> For some reason, the blank item caused every 5th label to disappear for no apparent reason. This seems like a bug. What's the address to report flex bugs to? Rick -- 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/ *> Your email settings: Individual Email | Traditional *> To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) *> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] *> 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/ -- Douglas Knudsen http://www.cubicleman.com this is my signature, like it? __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com image.tiff> SPONSORED LINKS Software development tool Software development Software development services Home design software Software development company x-tad-smaller Your email settings: Individual Email|Traditional/x-tad-smallerx-tad-smallerChange settings via the Web/x-tad-smallerx-tad-smaller (Yahoo! ID required) /x-tad-smallerx-tad-smaller Change settings via email: /x-tad-smallerx-tad-smallerSwitch delivery to Daily Digest/x-tad-smallerx-tad-smaller | /x-tad-smallerx-tad-smallerSwitch to Fully Featured/x-tad-smallerx-tad-smaller /x-tad-smallerx-tad-smaller Visit Your Group /x-tad-smallerx-tad-smaller /x-tad-smallerx-tad-smaller| /x-tad-smallerx-tad-smallerYahoo! Groups Terms of Use /x-tad-smallerx-tad-smaller /x-tad-smallerx-tad-smaller| /x-tad-smallerx-tad-smallerUnsubscribe /x-tad-smaller__,_._,___
Re: [flexcoders] Disappearing list items
I had forgotten about the portability issue with Web services, so Rick brings up a good point. Personally, I try to stay away from Web services (with Flex) as much as possible given the speed advantage of remoting and the [amazingly] easier integration. I'm just a Flex noob, but I'm curious how the FDS - CF Object integration is similar and dissimilar to using your method. Of course your method has nothing to do with FDS, but FDS gives you straight data-type mapping and immediate updates, blah blah. | Aaron West | aaron AT trajiklyhip DOT com | http://www.trajiklyhip.com/blog/ | Certified Advanced Adobe ColdFusion MX 7 Developer | Certified Macromedia FlashMX Developer | Adobe Community Expert On Oct 16, 2006, at 1:48 PM, Douglas Knudsen wrote: I'm inviting myself into the fight club here maybe...the first rulelol Converting the query to a array of objects means I can map them to AS objects enforcing my model. This mapping is one of my three favourite things about Flex. Example, say you want to populate a datagrid with query data and make it editable. Having this AS -> CFC mapping makes this cake by returning a array of objects to Flex, then Flex returning that SAME Array of objects modified back to CF. If you populated the datagrid with a query result, how do you get the edited data back to CF? Possible yes, but painful IMHO. Data that will never be edited I'd probably use XML for. Others will disagree, but that's just been my experience so far. XML is fast light and cheap via RemoteObject. Actually I found it to be real fast via HTTPService too. Without sounding like the 'herd mentality', its just a best practise too, eh? And one more reason, its just more sexy! Having been a Math major I need all the help I can get in that department. hehe! DK Disclaimer - If any of the above annoys you, sue the coffe makers that forced me to consume so much coffee today. :) On 10/16/06, Aaron West [EMAIL PROTECTED]> wrote:Douglas, out of curiosity how come you prefer to not send queries from CF to Flex? Also, what do you do instead? You mentioned converting the query record-set to an Array of Objects or XML. What benefits do you get on the Flex end for doing this considering its more work for CF? | Aaron West | aaron AT trajiklyhip DOT com | http://www.trajiklyhip.com/blog/ | Certified Advanced Adobe ColdFusion MX 7 Developer | Certified Macromedia FlashMX Developer | Adobe Community Expert On Oct 16, 2006, at 8:55 AM, Douglas Knudsen wrote: > odd. Myself, I prefer not to return queries from CF to Flex. > Instead convert to a array of objects or XML. That said, maybe try > using the SQL for it direct, in case the Query functions are flaking > somehow. The below would be for Oracle. > > cfquery name=qry2 dbtype=query> > SELECT > TABLKEY, TABLFLD > FROM application.udf.getalldropdowns > WHERE > TABLID = '010' > UNION > SELECT '' AS TABLKEY, '' AS TABLFLD > FROM dual > > > ORDER BY TABLFLD > /cfquery> > > DK > > > On 10/16/06, Rick Root [EMAIL PROTECTED]> wrote:so, I solved > this problem. >> >> My data provider was a query returned by a remoting call created like >> this: >> >> cfquery name=qry2 dbtype=query> >> SELECT >> TABLKEY, TABLFLD >> FROM application.udf.getalldropdowns >> WHERE >> TABLID = '010' >> ORDER BY TABLFLD >> /cfquery> >> cfset queryaddrow(qry2,1)> >> cfset querysetcell(qry2,TABLKEY,)> >> cfset querysetcell(qry2,TABLFLD,)> >> cfquery name=qry dbtype=query> >> SELECT * FROM qry2 ORDER BY TABLFLD >> /cfquery> >> cfset retval.COUNTRIES = qry> >> >> I did it this way so I could always have a blank item in the >> dropdown >> >> The solution was to change the second querysetcell line to be the >> following: >> >> cfset querysetcell(qry2,TABLFLD,- not selected -)> >> >> For some reason, the blank item caused every 5th label to disappear >> for >> no apparent reason. >> >> This seems like a bug.What's the address to report flex bugs to? >> >> Rick >> >> >> -- >> 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 >> >> >> >> > > > > -- > Douglas Knudsen > http://www.cubicleman.com > this is my signature, like it? -- Douglas Knudsen http://www.cubicleman.com this is my signature, like it? __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com im
[flexcoders] Re: DataGrid HeaderRenderer and DataProvider
No problem jelentz, check out the link I've provided below. While you are looking to dynamically set the dataProvider of a DataGrid the content of the article discusses a ComboBox. The takeaway from the article is how to create your own custom DataGrid class (by extending DataGrid) and then writing the appropriate code to manipulate the dataProvider. The article does a good job explain this. http://thesourcecode.org/?p=15 Let me know if you have questions (note, I didn't write the article.) | Aaron West | aaron AT trajiklyhip DOT com | http://www.trajiklyhip.com/blog/ | Certified Advanced Adobe ColdFusion MX 7 Developer | Certified Macromedia FlashMX Developer | Adobe Community Expert On Oct 14, 2006, at 12:20 PM, jlentz2112 wrote: Thanks for the reply, but unfortunately I don't follow all of it. I'm new to Flex, so could you please explain more? I get the AS3 extending DataGrid. How can you dynamically set the dataProvider to pass in info to the headerRenderer? A small snippet of code would be greatly appreciated. Thanks again, jelentz --- In flexcoders@yahoogroups.com, Aaron West [EMAIL PROTECTED] wrote: jelentz, Based on my limited experience I would suggest creating a custom AS3 class that extends DataGrid. You can then dynamically set the dataProvider, loop through whatever part of the data provider you need, and based on the values therein create the number of data grid columns you need. | Aaron West | aaron AT trajiklyhip DOT com | http://www.trajiklyhip.com/blog/ | Certified Advanced Adobe ColdFusion MX 7 Developer | Certified Macromedia FlashMX Developer | Adobe Community Expert On Oct 13, 2006, at 8:40 PM, jlentz2112 wrote: Hi, I've got an app where I need a DataGrid that will have a varying number of columns based on the value from a database query. I also need to be able to have each column header display a couple of images and the text provided by the database query. Is there a way to use a dataprovider to create a varying number of columns, and to use the dataprovider to pass in images and text? I've looked for examples and haven't had much luck finding any that I could follow. A simplified explanation would be greatly appreciated. Thank you, jelentz -- 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: 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/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * 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] Manipulating data before it populates the DataGrid
If you're using an ArrayCollection to populate your grid you could always edit/adjust or otherwise manipulate the data in your event handler. For instance, if you're using Web services, you can loop the data coming from the server and manipulate it as you add it into your ArrayCollection. Or, as suggested you can just use formatters to change *only* the display of specific columns w/o affecting the actual data. | Aaron West | aaron AT trajiklyhip DOT com | http://www.trajiklyhip.com/blog/ | Certified Advanced Adobe ColdFusion MX 7 Developer | Certified Macromedia FlashMX Developer | Adobe Community Expert On Oct 14, 2006, at 10:23 PM, iko_knyphausen wrote: Hi, what would be the best way to inspect and possibly manipulate data that gets populated into a DataGrid via data binding? This could be used to filter data, transform values, compute calculated fields etc. Is there a hook similar to the itemRenderer (which you could even 'abuse' for this, I guess)? An event that gets fired per record while populating? Obviously I am new to Flex, so forgive if I have overlooked the obvious. Thanks much -- 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/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
Re: [flexcoders] DataGrid HeaderRenderer and DataProvider
jelentz, Based on my limited experience I would suggest creating a custom AS3 class that extends DataGrid. You can then dynamically set the dataProvider, loop through whatever part of the data provider you need, and based on the values therein create the number of data grid columns you need. | Aaron West | aaron AT trajiklyhip DOT com | http://www.trajiklyhip.com/blog/ | Certified Advanced Adobe ColdFusion MX 7 Developer | Certified Macromedia FlashMX Developer | Adobe Community Expert On Oct 13, 2006, at 8:40 PM, jlentz2112 wrote: Hi, I've got an app where I need a DataGrid that will have a varying number of columns based on the value from a database query. I also need to be able to have each column header display a couple of images and the text provided by the database query. Is there a way to use a dataprovider to create a varying number of columns, and to use the dataprovider to pass in images and text? I've looked for examples and haven't had much luck finding any that I could follow. A simplified explanation would be greatly appreciated. Thank you, jelentz -- 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/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * 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: Horizontal alignment of inline checkbox in datagrid component
Over the last several days I've done tons of work with custom Checkboxes in DataGrid's. I have not tried the below recommendation from iko_knyphausen but I can offer my own experience. For me, I wanted to center the Checkbox in the DataGrid column. Using the DataGridColumn itself yield no positive results. So, like for many things an ItemRender was needed (just like you set up). However, when using the item renderer (serving as the renderer and the item editor: rendererIsEditor = true) I would get property errors when interacting with the Checkbox. The solution I employed was to create a custom item renderer class instead of a drop-in renderer. When doing this, you create a property of the class to hold the value of the Checkbox selection and then you bind this value to the grid column. The code looked like this (and it's the VBox that aids in centering): --Assume this mxml file is called CheckboxRenderer.mxml x-tad-smaller?xml version=1.0 encoding=utf-8?> mx:VBox xmlns:mx=http://www.adobe.com/2006/mxml horizontalAlign=center horizontalScrollPolicy=off verticalScrollPolicy=off> mx:Script> ![CDATA[ [Bindable] public var cbSelected:Boolean; ]]> /mx:Script> mx:CheckBox id=cbGeneric selected={cbSelected} click=cbSelected = cbGeneric.selected updateComplete=cbSelected = cbGeneric.selected/> /mx:VBox> Then, to bind the value of the cbSelected boolean to the grid column your datagrid column would look like this: mx/x-tad-smaller:Dx-tad-smallerataGridColumn id=yourID headerText=Column Header dataField=yourValue itemRenderer=CheckboxRenderer rendererIsEditor=true editorDataField=cbSelected/>/x-tad-smaller Now, we have a custom item renderer that also functions as our item editor (so there aren't 2 different states). The value of the editorDataField attribute - set to cbSelected - allows the datagrid column to keep up with the Checkbox selected value correctly. Implementing this custom mxml item renderer eliminated the error Property selected not found in blah blah and no default value is set. While this solved the problem of centering the Checkbox in the grid what happens if you want another column to use a centered Checkbox. Using the above method (mxml component) you cannot make the code generic enough where you can reuse it. I further solved this problem by dumping the mxml component and creating a custom ActionScript class that extended the Checkbox class. I essentially rewrote the mxml to equivalent AS3. This is prob. way more info than any of you wanted, but it's something that I struggled with for a few days and having figured out, may save you some time. | Aaron West | aaron AT trajiklyhip DOT com | http://www.trajiklyhip.com/blog/ | Certified Advanced Adobe ColdFusion MX 7 Developer | Certified Macromedia FlashMX Developer | Adobe Community Expert On Oct 13, 2006, at 11:37 PM, iko_knyphausen wrote: I finally got around to testing your suggestion. mx:DataGridColumn editable=false width=65 headerText=Member textAlign=center> mx:itemRenderer> mx:Component> mx:HBox> mx:CheckBox selected={data.member} change=data.member=selected /> /mx:HBox> /mx:Component> /mx:itemRenderer> …. The inline data.member works well but you have to switch editable property off, and update the listitem data manually via change event. Unfortunately, checkbox population fails the moment you wrap an HBOX around the checkbox. Works great without the HBOX. Any ideas? --- In flexcoders@yahoogroups.com, haravallabhan [EMAIL PROTECTED]> wrote: > > Iam just wondering How a Layout component has some affect on data?. > It works for me.. selected = {data.ColumnDataField} shoue populate > the value. > > > --- In flexcoders@yahoogroups.com, Iko Knyphausen iko@ wrote: > > > > I tried that, and indeed it will help align the checkbox, > unfortunately the > > data binding stops working. In other words, the moment you have an > hbox > > around the checkbox, the checkbox does not show as checked in > those rows > > that have true as data value. > > > > Hi, > > You can use HBox component or anoother layout compnent to say, > inside > > the itemRenderer like > > > > mx:DataGridColumn width=65 headerText=Member dataField=member > > textAlign=center > > > mx:itemRenderer> > > mx:Component> > > HBox> > > mx:CheckBox labelPlacement=left/> > > /HBox> > > /mx:Component> > > /mx:itemRenderer> > > /mx:DataGridColumn> > > > > thanks. > > > > --- In [EMAIL PROTECTED] mailto:flexcoders%40yahoogroups.com> > ups.com, > > iko_knyphausen iko@> wrote: > > > > > > > > > Hi, > > > > > > I am trying to use checkboxes in my datagrid, and everything > works > > fine, > > > exc
[flexcoders] Reusing Custom ItemRenderer in a DataGrid
x-tad-smallerAll, I've just signed up for the list hoping to get some help on some Flex items and also contribute any way I can. I've been developing in ColdFusion for 6 years and recently started integrating Flex 2.0 development with my CF development. Anyhow, enough about me, on to my question. I'm attempting to setup a custom ItemRenderer (a checkbox) in multiple DataGrid columns. I've successfully done this with one column already but when trying to make my custom ItemRenderer generic enough so it can be used across multiple columns I've run into issues. Below is snippet of my DataGrid code as well as the code for the custom ItemRenderer. The behavior I'm seeing is selecting the checkbox in the groupOwner column affects - in odd ways - the checboxes in the other columns using the same renderer. I'm pretty sure it's because all the columns reference the same name for the editorDataField attribute. But, I'm not sure how to make the value of that attribute different across columns and still use the same custom ItemRenderer. Can anyone point me in the right direction? // Custom Checkbox ItemRenderer // NOTE: Much of the code in the overridden method is speculative and // probably all wrong. ?xml version=1.0 encoding=utf-8?> mx:VBox xmlns:mx=http://www.adobe.com/2006/mxml horizontalAlign=center horizontalScrollPolicy=off verticalScrollPolicy=off> mx:Script> ![CDATA[ import mx.events.FlexEvent; import mx.controls.Alert; import mx.core.Application; [Bindable] public var cbSelected:Boolean; override public function set data(value:Object):void { if (value != null) { super.data = value; if (value.BISOWNER != null) { cbSelected = value.BISOWNER; } else if (value.BISEXPORTED != null) { mx.controls.Alert.show(bisexported); cbSelected = value.BISEXPORTED; } else if (value.ALLOWEDITS != null) { cbSelected = value.ALLOWEDITS; } else if (value.BISVINDECODE != null) { cbSelected = value.BISVINDECODE; } } dispatchEvent( new FlexEvent(FlexEvent.DATA_CHANGE)); } ]]> /mx:Script> mx:CheckBox id=cbGeneric selected={cbSelected} click=cbSelected = cbGeneric.selected updateComplete=cbSelected = cbGeneric.selected/> /mx:VBox> // DataGrid Snippet mx/x-tad-smaller:Dx-tad-smallerataGrid id=dgGroupingSetup dataProvider={groupingSetup} itemEditEnd=processDGEdit(event) width=100% editable=true height=246> mx:columns> mx/x-tad-smaller:Dx-tad-smallerataGridColumn id=groupID headerText=Group ID dataField=INVENTORYGROUPINGID editable=false width=60/> mx/x-tad-smaller:Dx-tad-smallerataGridColumn id=groupOwner headerText=Group Owner dataField=BISOWNER itemRenderer=ItemRenderers.GenericCheckboxRenderer rendererIsEditor=true editorDataField=cbSelected width=85/> mx/x-tad-smaller:Dx-tad-smallerataGridColumn id=exportData headerText=Export Data dataField=BISEXPORTED itemRenderer=ItemRenderers.GenericCheckboxRenderer rendererIsEditor=true editorDataField=cbSelected width=80/> mx/x-tad-smaller:Dx-tad-smallerataGridColumn id=allowEdits headerText=Allow Edits dataField=ALLOWEDITS itemRenderer=ItemRenderers.GenericCheckboxRenderer rendererIsEditor=true editorDataField=cbSelected width=75/> mx/x-tad-smaller:Dx-tad-smallerataGridColumn id=vinDecode headerText=VIN Decode dataField=BISVINDECODE itemRenderer=ItemRenderers.GenericCheckboxRenderer rendererIsEditor=true editorDataField=cbSelected width=80/>/x-tad-smaller /mx:columns> /mx:DataGrid> | Aaron West | aaron AT trajiklyhip DOT com | http://www.trajiklyhip.com/blog/ | Certified Advanced Adobe ColdFusion MX 7 Developer | Certified Macromedia FlashMX Developer | Adobe Community Expert