[flexcoders] Re: Desperate Help! crossdomain.xml
We ran into a similar situation with having the crossdomain.xml policy file in a subdirectory of a site. The phase 3 change that went into affect with FP10.02 requires the root directory of the site to have a meta policy file (policy file for policy files) that allows for the use of policy files in subdirectories. If it is missing then the site-control permitted-cross-domain-policies defaults to master only, causing all other policy files to fail security check. Therefore, the crossdomain.xml meta policy file placed in the root directory will have the following: ?xml version=1.0? !DOCTYPE cross-domain-policy SYSTEM http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd cross-domain-policy !-- The crossdomain meta policy file must be copied to the root of your site -- !-- Allow subsite policy files -- site-control permitted-cross-domain-policies=all/ /cross-domain-policy Then the subdirectory policy files will look something like the following: ?xml version=1.0? !DOCTYPE cross-domain-policy SYSTEM http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd cross-domain-policy allow-access-from domain=YourDomainHere to-ports=80 / !--above is best practice OR allow-access-from domain=* /-- allow-http-request-headers-from domain=YourDomainHere headers=* / !--above is best practice OR allow-http-request-headers-from domain=* headers=* /-- /cross-domain-policy The important part is having the meta policy file in the root directory. Hope this helps, CJ
[flexcoders] Dynamic text flowing
I have a custom component comprised of stacked mx:Text within a mx:VBox within a mx:HBox and using this component within a TileList. I need to have the text resize dynamically to show all the wrapped text within the Text to display within the tile. Some of the custom component is shown below... ?xml version=1.0 encoding=utf-8? mx:HBox xmlns:mx=http://www.adobe.com/2006/mxml; width=100% scroll=false clipContent=true horizontalScrollPolicy=off verticalScrollPolicy=off borderStyle=none verticalGap=0 horizontalGap=4 verticalAlign=top doubleClick=doubleClickEventHandler(event) doubleClickEnabled=true height=220 mx:Image source={data.statusImage} / mx:VBox width=50% height=100% mx:Text text=Associated Topic Name: {data.associated_topic} fontSize=9 fontFamily=Arial truncateToFit=true width=100% textAlign=left toolTip={data.associated_topic} fontWeight=bold enabled=true/ mx:Text text=Action Name: {data.name} fontSize=9 fontFamily=Arial width=100% textAlign=left toolTip={data.name} fontWeight=bold/ mx:Text text=Action Owner: {data.owner} fontSize=9 fontFamily=Arial width=100% textAlign=left toolTip={data.owner} fontWeight=bold/ mx:Text text=Action Description: {data.description} fontSize=9 fontFamily=Arial width=100% textAlign=left toolTip={data.description} fontWeight=bold/ /mx:VBox mx:VBox width=50% height=100% mx:Text text=Action Initiation Date: {data.initiation_date} fontSize=9 fontFamily=Arial width=100% textAlign=left toolTip={data.initiation_date} fontWeight=bold/ mx:Text text=Initial Due Date: {data.initial_due_date} fontSize=9 fontFamily=Arial width=100% textAlign=left toolTip={data.initial_due_date} fontWeight=bold/ mx:Text text=Action Revised Due Date: {data.revised_due_date} fontSize=9 fontFamily=Arial width=100% textAlign=left toolTip={data.revised_due_date} fontWeight=bold/ mx:Text text=Resolution Description: {data.resolution_description} fontSize=9 fontFamily=Arial width=100% textAlign=left toolTip={data.resolution_description} fontWeight=bold/ /mx:VBox /mx:HBox Any suggestions are welcomed. Thanks, CJ
[flexcoders] Re: Trying to underline datagrid header text. How???
Ok. I'll post any results here once I get'em. Thanks so much for your input Alex, you've helped me understand a little more about the renderers. Thanks again, CJ --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: When someone clicks the header, a HEADER_RELEASE event is dispatched, and if you call preventDefault() on the event, the sort will not take place. You should then go get the data. You can freeze the screen by putting up a modal popup or some other UI. Once the data is returned, store the name of the sort and use that in your renderers to show the underline. You would match against that name instead of owner.dataprovider.sort.sortField[0].name. Check the forum archives and search the internet. Someone has successfully overridden the actual Sort so sortarrows would continue to work but the underlying collection would not be sorted. -Alex From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of cjcuccaro Sent: Tuesday, September 16, 2008 6:17 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Trying to underline datagrid header text. How??? No there isn't a sort applied. I want to override the default sorting functionality so the data can be sorted on the server. Sorry I wasn't clear enough on one of my earlier posts. The sorting is done on the server to a much larger set of data than what is displayed in the Flex app. When I call the service and get the result, which is a subset of the overall result set, it is already sorted for display. Hmmm, is there a way to not override the default functionality but to just freeze the screen until the new sorted data is returned from the server to be displayed? If I can freeze the datagrid so the sorting on the flex side isn't seen and then unfreeze it when the new data arrives might work. Or... Can I override the default sort to prevent a normal sort just so the sort arrow remains? As you can tell I'm just grasping for any work around at this time. Thanks, CJ --- In flexcoders@yahoogroups.commailto:flexcoders% 40yahoogroups.com, Alex Harui aharui@ wrote: That looks ok. Is there really a sort applied to the collection/dataprovider or did you just happen to return the server results sorted in some way? From: flexcoders@yahoogroups.commailto:flexcoders% 40yahoogroups.com [mailto:flexcoders@yahoogroups.commailto:flexcoders% 40yahoogroups.com] On Behalf Of cjcuccaro Sent: Monday, September 15, 2008 5:30 AM To: flexcoders@yahoogroups.commailto:flexcoders% 40yahoogroups.com Subject: [flexcoders] Re: Trying to underline datagrid header text. How??? This is my check I put in the set data, sortEventHandler, and clickHandler events within the renderer: if(DataGrid(listData.owner).dataProvider.sort != null){ var sortVal:String = DataGrid (listData.owner).dataProvider.sort.sortField[0].name; } I put a break on the variable assignment within the if block and it doesn't stop within the block. Am I looking at the correct collection? Thanks, CJ --- In flexcoders@yahoogroups.commailto:flexcoders% 40yahoogroups.com, Alex Harui aharui@ wrote: Making changes in set data() makes you data-driven. Changing when events fire makes you event-driven. Maybe you're looking at the wrong collection? What does the code that checks the sortField look like? From: flexcoders@yahoogroups.commailto:flexcoders% 40yahoogroups.com [mailto:flexcoders@yahoogroups.commailto:flexcoders% 40yahoogroups.com] On Behalf Of cjcuccaro Sent: Sunday, September 14, 2008 6:28 AM To: flexcoders@yahoogroups.commailto:flexcoders% 40yahoogroups.com Subject: [flexcoders] Re: Trying to underline datagrid header text. How??? Hmmm. Thought I was data-driven. I did attempt to check the sortField but it was always null. I put checks in the sortEventHandler and the clickHandler to see when the sort would change to not null but it remained null. So when you say the header gets recycled it calls the set data method? Sh! ould I be making the changes in the set data method at this point? I feel like I'm wrestling an alligator and going 'round and 'round and doing nothing but getting tired. phew! Thank you again for your help Alex. Regards, CJ --- In flexcoders@yahoogroups.commailto:flexcoders% 40yahoogroups.commailto:flexcoders% 40yahoogroups.com, Alex Harui aharui@ wrote: See my reply from today. You need to be data-driven. I still think getting the collection's Sort and comparing the sortField against the column's dataField is the right plan. From: flexcoders@yahoogroups.commailto:flexcoders% 40yahoogroups.commailto:flexcoders% 40yahoogroups.com [mailto:flexcoders@yahoogroups.commailto:flexcoders% 40yahoogroups.commailto:flexcoders% 40yahoogroups.com] On Behalf Of cjcuccaro Sent: Saturday, September 13, 2008 6:31 PM To: [EMAIL
[flexcoders] Re: Trying to underline datagrid header text. How???
No there isn't a sort applied. I want to override the default sorting functionality so the data can be sorted on the server. Sorry I wasn't clear enough on one of my earlier posts. The sorting is done on the server to a much larger set of data than what is displayed in the Flex app. When I call the service and get the result, which is a subset of the overall result set, it is already sorted for display. Hmmm, is there a way to not override the default functionality but to just freeze the screen until the new sorted data is returned from the server to be displayed? If I can freeze the datagrid so the sorting on the flex side isn't seen and then unfreeze it when the new data arrives might work. Or... Can I override the default sort to prevent a normal sort just so the sort arrow remains? As you can tell I'm just grasping for any work around at this time. Thanks, CJ --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: That looks ok. Is there really a sort applied to the collection/dataprovider or did you just happen to return the server results sorted in some way? From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of cjcuccaro Sent: Monday, September 15, 2008 5:30 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Trying to underline datagrid header text. How??? This is my check I put in the set data, sortEventHandler, and clickHandler events within the renderer: if(DataGrid(listData.owner).dataProvider.sort != null){ var sortVal:String = DataGrid (listData.owner).dataProvider.sort.sortField[0].name; } I put a break on the variable assignment within the if block and it doesn't stop within the block. Am I looking at the correct collection? Thanks, CJ --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote: Making changes in set data() makes you data-driven. Changing when events fire makes you event-driven. Maybe you're looking at the wrong collection? What does the code that checks the sortField look like? From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of cjcuccaro Sent: Sunday, September 14, 2008 6:28 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Trying to underline datagrid header text. How??? Hmmm. Thought I was data-driven. I did attempt to check the sortField but it was always null. I put checks in the sortEventHandler and the clickHandler to see when the sort would change to not null but it remained null. So when you say the header gets recycled it calls the set data method? Sh! ould I be making the changes in the set data method at this point? I feel like I'm wrestling an alligator and going 'round and 'round and doing nothing but getting tired. phew! Thank you again for your help Alex. Regards, CJ --- In flexcoders@yahoogroups.commailto:flexcoders% 40yahoogroups.com, Alex Harui aharui@ wrote: See my reply from today. You need to be data-driven. I still think getting the collection's Sort and comparing the sortField against the column's dataField is the right plan. From: flexcoders@yahoogroups.commailto:flexcoders% 40yahoogroups.com [mailto:flexcoders@yahoogroups.commailto:flexcoders% 40yahoogroups.com] On Behalf Of cjcuccaro Sent: Saturday, September 13, 2008 6:31 PM To: [EMAIL PROTECTED] ups.commailto:flexcoders% 40yahoogroups.com gt; Subject: [flexcoders] Re: Trying to underline datagrid header text. How??? Well thought I had it licked but not! It works great until I make my HTTPService call to the Spring controller on the server to get the sorted result. Just like the sort arrow the underlining disappears after the service call. I only show 20 records out of a much larger result set so when sorting I need to call the HTTPservice again to get the sorted subset after the entire resultset is sorted on the server. E! Does anyone have a work around for this kind of behavior? What do I need to extend/override to keep the sort arrow or in my latest attempt the underlining? Any and all help is appreciated. Desperately, CJ --- In flexcoders@yahoogroups.commailto:flexcoders% 40yahoogroups.commailto:flexcoders% 40yahoogroups.com, cjcuccaro cj_cuccaro@ wrote: I believe I got it. I use the added sortEventHandler event listener to set the style textDecoration to none and the clickHandler to reset the textDecoration to underline. private function sortEventHandler (event:DataGridEvent):void { if (event.itemRenderer == this){ event.preventDefault(); } setStyle(textDecoration, none); } private function clickHandler(event:MouseEvent):void { setStyle(textDecoration, unde! rline); } g! t; BR and it took me way to many hours to come to this conclusion. yikes! Thanks for your input Alex, it is greatly appreciated
[flexcoders] Re: Trying to underline datagrid header text. How???
This is my check I put in the set data, sortEventHandler, and clickHandler events within the renderer: if(DataGrid(listData.owner).dataProvider.sort != null){ var sortVal:String = DataGrid(listData.owner).dataProvider.sort.sortField[0].name; } I put a break on the variable assignment within the if block and it doesn't stop within the block. Am I looking at the correct collection? Thanks, CJ --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: Making changes in set data() makes you data-driven. Changing when events fire makes you event-driven. Maybe you're looking at the wrong collection? What does the code that checks the sortField look like? From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of cjcuccaro Sent: Sunday, September 14, 2008 6:28 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Trying to underline datagrid header text. How??? Hmmm. Thought I was data-driven. I did attempt to check the sortField but it was always null. I put checks in the sortEventHandler and the clickHandler to see when the sort would change to not null but it remained null. So when you say the header gets recycled it calls the set data method? Should I be making the changes in the set data method at this point? I feel like I'm wrestling an alligator and going 'round and 'round and doing nothing but getting tired. phew! Thank you again for your help Alex. Regards, CJ --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, Alex Harui aharui@ wrote: See my reply from today. You need to be data-driven. I still think getting the collection's Sort and comparing the sortField against the column's dataField is the right plan. From: flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com] On Behalf Of cjcuccaro Sent: Saturday, September 13, 2008 6:31 PM To: flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com Subject: [flexcoders] Re: Trying to underline datagrid header text. How??? Well thought I had it licked but not! It works great until I make my HTTPService call to the Spring controller on the server to get the sorted result. Just like the sort arrow the underlining disappears after the service call. I only show 20 records out of a much larger result set so when sorting I need to call the HTTPservice again to get the sorted subset after the entire resultset is sorted on the server. E! Does anyone have a work around for this kind of behavior? What do I need to extend/override to keep the sort arrow or in my latest attempt the underlining? Any and all help is appreciated. Desperately, CJ --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.commailto:f\ lexcoders% 40yahoogroups.com, cjcuccaro cj_cuccaro@ wrote: I believe I got it. I use the added sortEventHandler event listener to set the style textDecoration to none and the clickHandler to reset the textDecoration to underline. private function sortEventHandler (event:DataGridEvent):void { if (event.itemRenderer == this){ event.preventDefault(); } setStyle(textDecoration, none); } private function clickHandler(event:MouseEvent):void { setStyle(textDecoration, underline); } and it took me way to many hours to come to this conclusion. yikes! Thanks for your input Alex, it is greatly appreciated. Regards, CJ --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.commailto:f\ lexcoders% 40yahoogroups.com, Alex Harui aharui@ wrote: I would probably test that the DataGrid (listData.owner).collection.sort.sortFIeld[0].name == data.dataField You'll need more null checks and what not but that tests to see if the sort on the collection is sorting on the same field as the column the header renderer is displaying. From: flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.commailto:f\ lexcoders% 40yahoogroups.com [mailto:flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com\ mailto:flexcoders% 40yahoogroups.com] On Behalf Of cjcuccaro Sent: Friday, September 12, 2008 8:27 PM To: flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.commailto:f\ lexcoders% 40yahoogroups.com Subject: [flexcoders] Re: Trying to underline datagrid header text. How??? Thank you Alex for your feedback. So I visited your blog read about renderers, very good info, and started with your checkbox example. I changed the checkbox to a label and have it underlining on the click but don't know how to toggle the underline when clicking other columns. Can you or anyone provide any suggestions on how I can achieve this? Below is the headerRenderer custom class. RgColHeaderLabel.as file: package { import mx.controls.Label
[flexcoders] Re: Trying to underline datagrid header text. How???
Jadi intinya nyari CV-nya atau SDM-nya? -sol- 2008/9/13 Doddy Prima [EMAIL PROTECTED] Thanks komentarnya. Mungkin di milist ini yang belum saya jelaskan lebih detail, tetang kepentingan dari CV dan dokumen lainnya. Secara singkat saja, Kita sedang mengerjakan project tepatnya 3 project besar yang saling berkaitan, jadi memebutuhkan 3 tim besar. Kita sudah menyiapkan spesifikasi tim, tapi kita juga ingin melihat dari sudut pandang berbeda, yaitu dari kemampuan masing2 personal. Ada 2 penyaringan CV ( dan dokumen lainnya), yaitu penyaringan pertama akan digunakan manajemen sebagai analisis dan kelengkapan dokumen project kami, dan setiap pemilik CV akan diberi pengganti . Penyaringan ke-2 yaitu digunakan untuk keperluan tenaga utama. Untuk dokumen yang dibutuhkan, saya rasa ngga ada yg aneh. Karena kelengkapan dokumen tsb memang dibutuhkan oleh pihak manajemen kami. Apakah ada dokumen rahasia yang saya minta ? Sebenarnya simple saja, kalau mau berpartisipasi, tinggal kirim CV dan kelengakapannya. Kalau menurut anda salah satu dokumen tsb ada yg ngga boleh di komsumsi ervice call to the Spring controller on the server to get the sorted result. Just like the sort arrow the underlining disappears after the service call. I only show 20 records out of a much larger result set so when sorting I need to call the HTTPservice again to get the sorted subset after the entire resultset is sorted on the server. E! Does anyone have a work around for this kind of behavior? What do I need to extend/override to keep the sort arrow or in my latest attempt the underlining? Any and all help is appreciated. Desperately, CJ --- In flexcoders@yahoogroups.commailto:flexcoders% 40yahoogroups.com, cjcuccaro cj_cuccaro@ wrote: I believe I got it. I use the added sortEventHandler event listener to set the style textDecoration to none and the clickHandler to reset the textDecoration to underline. private function sortEventHandler (event:DataGridEvent):void { if (event.itemRenderer == this){ event.preventDefault(); } setStyle(textDecoration, none); } private function clickHandler(event:MouseEvent):void { setStyle(textDecoration, underline); } and it took me way to many hours to come to this conclusion. yikes! Thanks for your input Alex, it is greatly appreciated. Regards, CJ --- In flexcoders@yahoogroups.commailto:flexcoders% 40yahoogroups.com, Alex Harui aharui@ wrote: I would probably test that the DataGrid (listData.owner).collection.sort.sortFIeld[0].name == data.dataField You'll need more null checks and what not but that tests to see if the sort on the collection is sorting on the same field as the column the header renderer is displaying. From: flexcoders@yahoogroups.commailto:flexcoders% 40yahoogroups.com [mailto:flexcoders@yahoogroups.commailto:flexcoders% 40yahoogroups.com] On Behalf Of cjcuccaro Sent: Friday, September 12, 2008 8:27 PM To: flexcoders@yahoogroups.commailto:flexcoders% 40yahoogroups.com Subject: [flexcoders] Re: Trying to underline datagrid header text. How??? Thank you Alex for your feedback. So I visited your blog read about renderers, very good info, and started with your checkbox example. I changed the checkbox to a label and have it underlining on the click but don't know how to toggle the underline when clicking other columns. Can you or anyone provide any suggestions on how I can achieve this? Below is the headerRenderer custom class. RgColHeaderLabel.as file: package { import mx.controls.Label; public class RgColHeaderLabel extends Label { import flash.events.MouseEvent; import mx.events.DataGridEvent; import mx.controls.DataGrid; import mx.controls.dataGridClasses.DataGridColumn; import mx.controls.dataGridClasses.DataGridListData; private var _data:DataGridColumn; public function RgColHeaderLabel() { super(); addEventListener(click, clickHandler); } override public function get data():Object { return _data; } override public function set data(value:Object):void { _data = value as DataGridColumn; text = DataGridListData(listData).label ; setStyle(textAlign,center); DataGrid(listData.owner).addEventListener (DataGridEvent.HEADER_RELEASE, sortEventHandler); } private function sortEventHandler(event:DataGridEvent):void { if (event.itemRenderer == this) event.preventDefault(); } private function clickHandler(event:MouseEvent):void { //how do i underline only the clicked header? setStyle(textDecoration, underline); } } } Below is your dg.mxml with a modification to the headerRenderer: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; xmlns:local=* mx:Script ![CDATA[ private var dp:Array
[flexcoders] Re: Trying to underline datagrid header text. How???
I am looping through the columns and comparing headerText with this clickHandler: private function clickHandler(event:MouseEvent):void { var colObj:Array = DataGrid(listData.owner).columns; for(var col:String in colObj){ trace(data.dataField = +data.dataField); trace((colObj[+col+].headerText=+colObj[col].headerText + == this.listData.label= + this.listData.label +) is + (colObj [col].headerText==this.listData.label)); trace(DataGrid(listData.owner).dataProvider.sort is null: + (DataGrid(listData.owner).dataProvider.sort == null)); if(colObj[col].headerText != this.listData.label){ colObj[col].setStyle(textDecoration, none); }else{ setStyle(textDecoration, underline); } } } Trace output: data.dataField = symbol (colObj[0].headerText=Name == this.listData.label=Symbol) is false DataGrid(listData.owner).dataProvider.sort is null: true data.dataField = symbol (colObj[1].headerText=Symbol == this.listData.label=Symbol) is true DataGrid(listData.owner).dataProvider.sort is null: true data.dataField = symbol (colObj[2].headerText=News == this.listData.label=Symbol) is false DataGrid(listData.owner).dataProvider.sort is null: true My problem now is how do I get at the label to set the style in the if...else block? How do I reset the other underlined headerText that may have been underlined in a prior sort selection while looping through the array? Thanks, CJ --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: I would probably test that the DataGrid (listData.owner).collection.sort.sortFIeld[0].name == data.dataField You'll need more null checks and what not but that tests to see if the sort on the collection is sorting on the same field as the column the header renderer is displaying. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of cjcuccaro Sent: Friday, September 12, 2008 8:27 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Trying to underline datagrid header text. How??? Thank you Alex for your feedback. So I visited your blog read about renderers, very good info, and started with your checkbox example. I changed the checkbox to a label and have it underlining on the click but don't know how to toggle the underline when clicking other columns. Can you or anyone provide any suggestions on how I can achieve this? Below is the headerRenderer custom class. RgColHeaderLabel.as file: package { import mx.controls.Label; public class RgColHeaderLabel extends Label { import flash.events.MouseEvent; import mx.events.DataGridEvent; import mx.controls.DataGrid; import mx.controls.dataGridClasses.DataGridColumn; import mx.controls.dataGridClasses.DataGridListData; private var _data:DataGridColumn; public function RgColHeaderLabel() { super(); addEventListener(click, clickHandler); } override public function get data():Object { return _data; } override public function set data(value:Object):void { _data = value as DataGridColumn; text = DataGridListData(listData).label ; setStyle(textAlign,center); DataGrid(listData.owner).addEventListener (DataGridEvent.HEADER_RELEASE, sortEventHandler); } private function sortEventHandler(event:DataGridEvent):void { if (event.itemRenderer == this) event.preventDefault(); } private function clickHandler(event:MouseEvent):void { //how do i underline only the clicked header? setStyle(textDecoration, underline); } } } Below is your dg.mxml with a modification to the headerRenderer: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; xmlns:local=* mx:Script ![CDATA[ private var dp:Array = [ { symbol: ADBE, name: Adobe Systems Inc., news: Adobe Flex is bgreat/b! according to iFlexCoders/i }, { symbol: MACR, name: Macromedia Inc., news: FONT color='#FF'Macromedia/FONT is absorbed into Adobe }, { symbol: MSFT, name: Microsoft Corp., news: Microsoft sees FONT size='20'Flex/FONT for the first time }, { symbol: IBM, name: IBM Corp., news: IBM was once the top bidog/i/b but no more } ]; ]] /mx:Script mx:DataGrid id=dg1 initialize=dg1.dataProvider = dp paddingTop=0 paddingBottom=0 verticalAlign=middle variableRowHeight=true mx:columns mx:DataGridColumn headerText=Name dataField=name width=140 headerRenderer=RgColHeaderLabel/ mx:DataGridColumn headerText=Symbol dataField=symbol width=60 headerRenderer=RgColHeaderLabel/ mx:DataGridColumn headerText=News dataField=news wordWrap=true width=200 headerRenderer=RgColHeaderLabel/ /mx:columns /mx:DataGrid /mx:Application Thanks, CJ
[flexcoders] Re: Trying to underline datagrid header text. How???
I believe I got it. I use the added sortEventHandler event listener to set the style textDecoration to none and the clickHandler to reset the textDecoration to underline. private function sortEventHandler (event:DataGridEvent):void { if (event.itemRenderer == this){ event.preventDefault(); } setStyle(textDecoration, none); } private function clickHandler(event:MouseEvent):void { setStyle(textDecoration, underline); } and it took me way to many hours to come to this conclusion. yikes! Thanks for your input Alex, it is greatly appreciated. Regards, CJ --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: I would probably test that the DataGrid (listData.owner).collection.sort.sortFIeld[0].name == data.dataField You'll need more null checks and what not but that tests to see if the sort on the collection is sorting on the same field as the column the header renderer is displaying. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of cjcuccaro Sent: Friday, September 12, 2008 8:27 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Trying to underline datagrid header text. How??? Thank you Alex for your feedback. So I visited your blog read about renderers, very good info, and started with your checkbox example. I changed the checkbox to a label and have it underlining on the click but don't know how to toggle the underline when clicking other columns. Can you or anyone provide any suggestions on how I can achieve this? Below is the headerRenderer custom class. RgColHeaderLabel.as file: package { import mx.controls.Label; public class RgColHeaderLabel extends Label { import flash.events.MouseEvent; import mx.events.DataGridEvent; import mx.controls.DataGrid; import mx.controls.dataGridClasses.DataGridColumn; import mx.controls.dataGridClasses.DataGridListData; private var _data:DataGridColumn; public function RgColHeaderLabel() { super(); addEventListener(click, clickHandler); } override public function get data():Object { return _data; } override public function set data(value:Object):void { _data = value as DataGridColumn; text = DataGridListData(listData).label ; setStyle(textAlign,center); DataGrid(listData.owner).addEventListener (DataGridEvent.HEADER_RELEASE, sortEventHandler); } private function sortEventHandler(event:DataGridEvent):void { if (event.itemRenderer == this) event.preventDefault(); } private function clickHandler(event:MouseEvent):void { //how do i underline only the clicked header? setStyle(textDecoration, underline); } } } Below is your dg.mxml with a modification to the headerRenderer: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; xmlns:local=* mx:Script ![CDATA[ private var dp:Array = [ { symbol: ADBE, name: Adobe Systems Inc., news: Adobe Flex is bgreat/b! according to iFlexCoders/i }, { symbol: MACR, name: Macromedia Inc., news: FONT color='#FF'Macromedia/FONT is absorbed into Adobe }, { symbol: MSFT, name: Microsoft Corp., news: Microsoft sees FONT size='20'Flex/FONT for the first time }, { symbol: IBM, name: IBM Corp., news: IBM was once the top bidog/i/b but no more } ]; ]] /mx:Script mx:DataGrid id=dg1 initialize=dg1.dataProvider = dp paddingTop=0 paddingBottom=0 verticalAlign=middle variableRowHeight=true mx:columns mx:DataGridColumn headerText=Name dataField=name width=140 headerRenderer=RgColHeaderLabel/ mx:DataGridColumn headerText=Symbol dataField=symbol width=60 headerRenderer=RgColHeaderLabel/ mx:DataGridColumn headerText=News dataField=news wordWrap=true width=200 headerRenderer=RgColHeaderLabel/ /mx:columns /mx:DataGrid /mx:Application Thanks, CJ
[flexcoders] Re: Trying to underline datagrid header text. How???
Well thought I had it licked but not! It works great until I make my HTTPService call to the Spring controller on the server to get the sorted result. Just like the sort arrow the underlining disappears after the service call. I only show 20 records out of a much larger result set so when sorting I need to call the HTTPservice again to get the sorted subset after the entire resultset is sorted on the server. E! Does anyone have a work around for this kind of behavior? What do I need to extend/override to keep the sort arrow or in my latest attempt the underlining? Any and all help is appreciated. Desperately, CJ --- In flexcoders@yahoogroups.com, cjcuccaro [EMAIL PROTECTED] wrote: I believe I got it. I use the added sortEventHandler event listener to set the style textDecoration to none and the clickHandler to reset the textDecoration to underline. private function sortEventHandler (event:DataGridEvent):void { if (event.itemRenderer == this){ event.preventDefault(); } setStyle(textDecoration, none); } private function clickHandler(event:MouseEvent):void { setStyle(textDecoration, underline); } and it took me way to many hours to come to this conclusion. yikes! Thanks for your input Alex, it is greatly appreciated. Regards, CJ --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote: I would probably test that the DataGrid (listData.owner).collection.sort.sortFIeld[0].name == data.dataField You'll need more null checks and what not but that tests to see if the sort on the collection is sorting on the same field as the column the header renderer is displaying. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of cjcuccaro Sent: Friday, September 12, 2008 8:27 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Trying to underline datagrid header text. How??? Thank you Alex for your feedback. So I visited your blog read about renderers, very good info, and started with your checkbox example. I changed the checkbox to a label and have it underlining on the click but don't know how to toggle the underline when clicking other columns. Can you or anyone provide any suggestions on how I can achieve this? Below is the headerRenderer custom class. RgColHeaderLabel.as file: package { import mx.controls.Label; public class RgColHeaderLabel extends Label { import flash.events.MouseEvent; import mx.events.DataGridEvent; import mx.controls.DataGrid; import mx.controls.dataGridClasses.DataGridColumn; import mx.controls.dataGridClasses.DataGridListData; private var _data:DataGridColumn; public function RgColHeaderLabel() { super(); addEventListener(click, clickHandler); } override public function get data():Object { return _data; } override public function set data(value:Object):void { _data = value as DataGridColumn; text = DataGridListData(listData).label ; setStyle(textAlign,center); DataGrid(listData.owner).addEventListener (DataGridEvent.HEADER_RELEASE, sortEventHandler); } private function sortEventHandler(event:DataGridEvent):void { if (event.itemRenderer == this) event.preventDefault(); } private function clickHandler(event:MouseEvent):void { //how do i underline only the clicked header? setStyle(textDecoration, underline); } } } Below is your dg.mxml with a modification to the headerRenderer: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; xmlns:local=* mx:Script ![CDATA[ private var dp:Array = [ { symbol: ADBE, name: Adobe Systems Inc., news: Adobe Flex is bgreat/b! according to iFlexCoders/i }, { symbol: MACR, name: Macromedia Inc., news: FONT color='#FF'Macromedia/FONT is absorbed into Adobe }, { symbol: MSFT, name: Microsoft Corp., news: Microsoft sees FONT size='20'Flex/FONT for the first time }, { symbol: IBM, name: IBM Corp., news: IBM was once the top bidog/i/b but no more } ]; ]] /mx:Script mx:DataGrid id=dg1 initialize=dg1.dataProvider = dp paddingTop=0 paddingBottom=0 verticalAlign=middle variableRowHeight=true mx:columns mx:DataGridColumn headerText=Name dataField=name width=140 headerRenderer=RgColHeaderLabel/ mx:DataGridColumn headerText=Symbol dataField=symbol width=60 headerRenderer=RgColHeaderLabel/ mx:DataGridColumn headerText=News dataField=news wordWrap=true width=200 headerRenderer=RgColHeaderLabel/ /mx:columns /mx:DataGrid /mx:Application Thanks, CJ
[flexcoders] Trying to underline datagrid header text. How???
I am using the headerRelease event in the DataGrid control and calling preventDefault in my header release custom function, which, as you know, keeps the sort arrow from displaying. Therefore, I want to do a less complicated work around and just underline the header text when the column is sorted. Is there a way to underline the header text just for the sorted column? OR Does anyone have a good work around for the ellusive sort arrow. I did notice a post by Alex Harui http://tech.groups.yahoo.com/group/flexcoders/message/121805 that talks about subclassing a collection and either override the sort property or refresh method so the collection doesn't actually sort. Can anyone give some guidiance on this? Thanks much, CJ
[flexcoders] Re: Trying to underline datagrid header text. How???
Thank you Alex for your feedback. So I visited your blog read about renderers, very good info, and started with your checkbox example. I changed the checkbox to a label and have it underlining on the click but don't know how to toggle the underline when clicking other columns. Can you or anyone provide any suggestions on how I can achieve this? Below is the headerRenderer custom class. RgColHeaderLabel.as file: package { import mx.controls.Label; public class RgColHeaderLabel extends Label { import flash.events.MouseEvent; import mx.events.DataGridEvent; import mx.controls.DataGrid; import mx.controls.dataGridClasses.DataGridColumn; import mx.controls.dataGridClasses.DataGridListData; private var _data:DataGridColumn; public function RgColHeaderLabel() { super(); addEventListener(click, clickHandler); } override public function get data():Object { return _data; } override public function set data(value:Object):void { _data = value as DataGridColumn; text = DataGridListData(listData).label ; setStyle(textAlign,center); DataGrid(listData.owner).addEventListener(DataGridEvent.HEADER_RELEASE, sortEventHandler); } private function sortEventHandler(event:DataGridEvent):void { if (event.itemRenderer == this) event.preventDefault(); } private function clickHandler(event:MouseEvent):void { //how do i underline only the clicked header? setStyle(textDecoration, underline); } } } Below is your dg.mxml with a modification to the headerRenderer: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml xmlns:local=* mx:Script ![CDATA[ private var dp:Array = [ { symbol: ADBE, name: Adobe Systems Inc., news: Adobe Flex is bgreat/b! according to iFlexCoders/i }, { symbol: MACR, name: Macromedia Inc., news: FONT color='#FF'Macromedia/FONT is absorbed into Adobe }, { symbol: MSFT, name: Microsoft Corp., news: Microsoft sees FONT size='20'Flex/FONT for the first time }, { symbol: IBM, name: IBM Corp., news: IBM was once the top bidog/i/b but no more } ]; ]] /mx:Script mx:DataGrid id=dg1 initialize=dg1.dataProvider = dp paddingTop=0 paddingBottom=0 verticalAlign=middle variableRowHeight=true mx:columns mx:DataGridColumn headerText=Name dataField=name width=140 headerRenderer=RgColHeaderLabel/ mx:DataGridColumn headerText=Symbol dataField=symbol width=60 headerRenderer=RgColHeaderLabel/ mx:DataGridColumn headerText=News dataField=news wordWrap=true width=200 headerRenderer=RgColHeaderLabel/ /mx:columns /mx:DataGrid /mx:Application Thanks, CJ