[flexcoders] Problem while sorting DataGrid column
I saw an weird behavior while sorting datagrid column. 1. Launch an application with editable datagrid one tab of any browser. 2. Datagrid should have more values than its height so that vertical scroll bar appears... 3. Click on any one column header to sort that column It works perfectly fine 4. Open other tab from the same browser and then come back to the tab in which application is launched. 5. Again click on column header in order to sort the column. Actual Behavior: Vertical scroll changes its position each time we click on column header. Expected Behavior: Vertical scroll should not change its position as it behaved as mentioned after step 3. Here is the sample application: ?xml version=1.0 encoding=utf-8? s:Application xmlns:fx=http://ns.adobe.com/mxml/2009; xmlns:s=library://ns.adobe.com/flex/spark xmlns:mx=library://ns.adobe.com/flex/halo minWidth=1024 minHeight=768 s:Panel width=100% height=25% mx:DataGrid x=0 y=45 width=100% height=100% rowHeight=25 fontSize=12 fontWeight=normal borderVisible=false editable=true wordWrap=true mx:dataProvider fx:Object col1=World of Warcraft col2=Blizzard col3=Blizzard col4=dasf col5=sdgf/ fx:Object col1=Halo col2=Bungie col3=Microsoft col4=dasf col5=sdgf/ fx:Object col1=Gears of War col2=Epic col3=Microsoft col4=dasf col5=sdgf/ fx:Object col1=XYZ col2=Epic col3=Microsoft col4=dasf col5=sdgf/ fx:Object col1=ABC col2=Epic col3=Microsoft col4=dasf col5=sdgf/ fx:Object col1=123 col2=Epic col3=Microsoft col4=dasf col5=sdgf/ fx:Object col1=4687 col2=Epic col3=Microsoft col4=dasf col5=sdgf/ /mx:dataProvider mx:columns mx:DataGridColumn dataField=col1/ mx:DataGridColumn dataField=col2/ mx:DataGridColumn dataField=col3/ mx:DataGridColumn dataField=col4/ mx:DataGridColumn dataField=col5/ /mx:columns /mx:DataGrid /s:Panel /s:Application If I remove editable=true property from datagrid then it works as expected. Does anybody else faced the same issue? Is there any workaround for this issue? Please let me know if anybody knows any workaround for this issue. - -- Regards, Yogesh Patil. -- View this message in context: http://old.nabble.com/Problem-while-sorting-DataGrid-column-tp28182757p28182757.html Sent from the FlexCoders mailing list archive at Nabble.com.
RE: [flexcoders] Problem while sorting DataGrid column
I don't think I'm seeing the same behavior as you. I only see the scrolling behavior if there is an item selected in the DataGrid, in which case it autoscrolls after clicking the data grid header so that the selected item is always visible. Based on your halo namespace, you may want to try updating to a newer Flex 4 SDK. That namespace was changed to mx quite a while ago (Dec 09 -- http://blogs.adobe.com/pdehaan/2009/12/the_flex_4_halo_namespace_is_n.html) Peter From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Patil Yogesh Sent: Thursday, April 08, 2010 11:39 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Problem while sorting DataGrid column I saw an weird behavior while sorting datagrid column. 1. Launch an application with editable datagrid one tab of any browser. 2. Datagrid should have more values than its height so that vertical scroll bar appears... 3. Click on any one column header to sort that column It works perfectly fine 4. Open other tab from the same browser and then come back to the tab in which application is launched. 5. Again click on column header in order to sort the column. Actual Behavior: Vertical scroll changes its position each time we click on column header. Expected Behavior: Vertical scroll should not change its position as it behaved as mentioned after step 3. Here is the sample application: ?xml version=1.0 encoding=utf-8? s:Application xmlns:fx=http://ns.adobe.com/mxml/2009; xmlns:s=library://ns.adobe.com/flex/spark xmlns:mx=library://ns.adobe.com/flex/halo minWidth=1024 minHeight=768 s:Panel width=100% height=25% mx:DataGrid x=0 y=45 width=100% height=100% rowHeight=25 fontSize=12 fontWeight=normal borderVisible=false editable=true wordWrap=true mx:dataProvider fx:Object col1=World of Warcraft col2=Blizzard col3=Blizzard col4=dasf col5=sdgf/ fx:Object col1=Halo col2=Bungie col3=Microsoft col4=dasf col5=sdgf/ fx:Object col1=Gears of War col2=Epic col3=Microsoft col4=dasf col5=sdgf/ fx:Object col1=XYZ col2=Epic col3=Microsoft col4=dasf col5=sdgf/ fx:Object col1=ABC col2=Epic col3=Microsoft col4=dasf col5=sdgf/ fx:Object col1=123 col2=Epic col3=Microsoft col4=dasf col5=sdgf/ fx:Object col1=4687 col2=Epic col3=Microsoft col4=dasf col5=sdgf/ /mx:dataProvider mx:columns mx:DataGridColumn dataField=col1/ mx:DataGridColumn dataField=col2/ mx:DataGridColumn dataField=col3/ mx:DataGridColumn dataField=col4/ mx:DataGridColumn dataField=col5/ /mx:columns /mx:DataGrid /s:Panel /s:Application If I remove editable=true property from datagrid then it works as expected. Does anybody else faced the same issue? Is there any workaround for this issue? Please let me know if anybody knows any workaround for this issue. - -- Regards, Yogesh Patil. -- View this message in context: http://old.nabble.com/Problem-while-sorting-DataGrid-column-tp28182757p28182757.html Sent from the FlexCoders mailing list archive at Nabble.com.
Re: [flexcoders] Problem while sorting DataGrid column
Are you using Flex 3.5 or later? I think we tried to fix that in 3.5 On 4/8/10 11:39 AM, Patil Yogesh patilyoge...@gmail.com wrote: I saw an weird behavior while sorting datagrid column. 1. Launch an application with editable datagrid one tab of any browser. 2. Datagrid should have more values than its height so that vertical scroll bar appears... 3. Click on any one column header to sort that column It works perfectly fine 4. Open other tab from the same browser and then come back to the tab in which application is launched. 5. Again click on column header in order to sort the column. Actual Behavior: Vertical scroll changes its position each time we click on column header. Expected Behavior: Vertical scroll should not change its position as it behaved as mentioned after step 3. Here is the sample application: ?xml version=1.0 encoding=utf-8? s:Application xmlns:fx=http://ns.adobe.com/mxml/2009; xmlns:s=library://ns.adobe.com/flex/spark xmlns:mx=library://ns.adobe.com/flex/halo minWidth=1024 minHeight=768 s:Panel width=100% height=25% mx:DataGrid x=0 y=45 width=100% height=100% rowHeight=25 fontSize=12 fontWeight=normal borderVisible=false editable=true wordWrap=true mx:dataProvider fx:Object col1=World of Warcraft col2=Blizzard col3=Blizzard col4=dasf col5=sdgf/ fx:Object col1=Halo col2=Bungie col3=Microsoft col4=dasf col5=sdgf/ fx:Object col1=Gears of War col2=Epic col3=Microsoft col4=dasf col5=sdgf/ fx:Object col1=XYZ col2=Epic col3=Microsoft col4=dasf col5=sdgf/ fx:Object col1=ABC col2=Epic col3=Microsoft col4=dasf col5=sdgf/ fx:Object col1=123 col2=Epic col3=Microsoft col4=dasf col5=sdgf/ fx:Object col1=4687 col2=Epic col3=Microsoft col4=dasf col5=sdgf/ /mx:dataProvider mx:columns mx:DataGridColumn dataField=col1/ mx:DataGridColumn dataField=col2/ mx:DataGridColumn dataField=col3/ mx:DataGridColumn dataField=col4/ mx:DataGridColumn dataField=col5/ /mx:columns /mx:DataGrid /s:Panel /s:Application If I remove editable=true property from datagrid then it works as expected. Does anybody else faced the same issue? Is there any workaround for this issue? Please let me know if anybody knows any workaround for this issue. - -- Regards, Yogesh Patil. -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
[flexcoders] Problem in sorting XMLList collection as a dataProvider for the list
Hi Guys I am trying to sort the xmllist collection which is the dataprovider for the list. As the implementation of name-value pairs, i am displaying the entries in form of string in List and would like to sort all the data displayed in the List alphabetically, I am making a call through amfphp call to grab data from backend and populate XMLListCollection but now I need to sort the data in the list. Below is the code,Can anyone please help me where I am messing things up. Also please let me know if there is any question regarding the code and if there is better way of doing it. Thanks /**CODE/ mx:RemoteObject id=amfSetup source=Setup destination=amfphp mx:method name=getList result=getListHandler(event); fault=getListFault(event);/ /mx:RemoteObject [Bindable] private var entriesXmlListFull:XMLList; [Bindable] private var entriesXmlCollection:XMLListCollection; public function getListHandler(event:ResultEvent):void { entriesXmlListFull = XML(event.result).device; populateEntries(); } private function getListFault(event:FaultEvent):void { Alert.Show(Error retreiving Data); } //Displaying names need to be displayed in the List box private function entriesLabelFunc(item:Object):String { var xmlItem:XML = item as XML; return xmlItem..attribute.(@name==friendlyname); } //Populating List with XML Objects private function populateEntries():void { entriesXmlCollection = new XMLListCollection(); for each(var item:XML in entriesXmlListFull) { var friendlyName:String = item..attribute.(@name==friendlyname); //Only add camera type if ( !recordValue hasFriendlyName (itemType.toUpperCase() == CAMERA) ) { entriesXmlCollection.addItem(item); } } //Calling Sort on XMLList collection entriesXmlCollection.sort = sortList; entriesXmlCollection.refresh(); } mx:Sort id=sortList mx:fields mx:SortField name=* caseInsensitive=true / /mx:fields /mx:Sort mx:List id=listData dataProvider={entriesXmlCollection} labelFunction=entriesLabelFunc/
RE: [flexcoders] Problem in sorting XMLList collection as a dataProvider for the list
I would use a sort function, so I could debug any problems. I'd also suggest an e4x expression instead of the loop. Tracy _ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of anuj181 Sent: Wednesday, March 04, 2009 6:51 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Problem in sorting XMLList collection as a dataProvider for the list Hi Guys I am trying to sort the xmllist collection which is the dataprovider for the list. As the implementation of name-value pairs, i am displaying the entries in form of string in List and would like to sort all the data displayed in the List alphabetically, I am making a call through amfphp call to grab data from backend and populate XMLListCollection but now I need to sort the data in the list. Below is the code,Can anyone please help me where I am messing things up. Also please let me know if there is any question regarding the code and if there is better way of doing it. Thanks /**CODE/ mx:RemoteObject id=amfSetup source=Setup destination=amfphp mx:method name=getList result=getListHandler(event); fault=getListFault(event);/ /mx:RemoteObject [Bindable] private var entriesXmlListFull:XMLList; [Bindable] private var entriesXmlCollection:XMLListCollection; public function getListHandler(event:ResultEvent):void { entriesXmlListFull = XML(event.result).device; populateEntries(); } private function getListFault(event:FaultEvent):void { Alert.Show(Error retreiving Data); } //Displaying names need to be displayed in the List box private function entriesLabelFunc(item:Object):String { var xmlItem:XML = item as XML; return xmlItem..attribute.(@name==friendlyname); } //Populating List with XML Objects private function populateEntries():void { entriesXmlCollection = new XMLListCollection(); for each(var item:XML in entriesXmlListFull) { var friendlyName:String = item..attribute.(@name==friendlyname); //Only add camera type if ( !recordValue hasFriendlyName (itemType.toUpperCase() == CAMERA) ) { entriesXmlCollection.addItem(item); } } //Calling Sort on XMLList collection entriesXmlCollection.sort = sortList; entriesXmlCollection.refresh(); } mx:Sort id=sortList mx:fields mx:SortField name=* caseInsensitive=true / /mx:fields /mx:Sort mx:List id=listData dataProvider={entriesXmlCollection} labelFunction=entriesLabelFunc/
[flexcoders] Problem in Sorting XMLListCollection (which is dataProvider for) the List
Hi Guys I am trying to sort the dataProvider in the list which is in the form of XMLListCollection, I am using amfPHP for grabbing data in the form of XMLListCollection and for the display purpose I am using labelfunction to display just the friendly name of my entries which is the specific attribute from the XMLListCollection. I went through few tutorials online for sorting and came up with the following code but some how this is not working, Can any one please help me in figruing out whats going on here and why sorting of the list is not working, Thanks /**CODE*/ mx:RemoteObject id=amfSetup source=Setup destination=amfphp mx:method name=getList result=getListHandler(event); fault=getListFault(event);/ /mx:RemoteObject [Bindable] private var entriesXmlListFull:XMLList; [Bindable] private var entriesXmlCollection:XMLListCollection; public function getListHandler(event:ResultEvent):void { entriesXmlListFull = XML(event.result).device; populateEntries(); } private function getListFault(event:FaultEvent):void { Alert.Show(Error retreiving Data); } //Displaying names need to be displayed in the List box private function entriesLabelFunc(item:Object):String { var xmlItem:XML = item as XML; return xmlItem..attribute.(@name==friendlyname); } //Populating List with XML Objects private function populateEntries():void { entriesXmlCollection = new XMLListCollection(); for each(var item:XML in entriesXmlListFull) { var friendlyName:String = item..attribute.(@name==friendlyname); //Only add camera type if ( !recordValue hasFriendlyName (itemType.toUpperCase() == CAMERA) ) { entriesXmlCollection.addItem(item); } } //Calling Sort on XMLList collection entriesXmlCollection.sort = sortList; entriesXmlCollection.refresh(); } mx:Sort id=sortList mx:fields mx:SortField name=* caseInsensitive=true / /mx:fields /mx:Sort mx:List id=listData dataProvider={entriesXmlCollection} labelFunction=entriesLabelFunc/
RE: [flexcoders] Problem in sorting XMLList collection as a dataProvider for the list
If you have a labelfunction, you'll probably need a custom sortcompare function Alex Harui Flex SDK Developer Adobe Systems Inc.http://www.adobe.com/ Blog: http://blogs.adobe.com/aharui From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of anuj181 Sent: Wednesday, March 04, 2009 3:51 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Problem in sorting XMLList collection as a dataProvider for the list Hi Guys I am trying to sort the xmllist collection which is the dataprovider for the list. As the implementation of name-value pairs, i am displaying the entries in form of string in List and would like to sort all the data displayed in the List alphabetically, I am making a call through amfphp call to grab data from backend and populate XMLListCollection but now I need to sort the data in the list. Below is the code,Can anyone please help me where I am messing things up. Also please let me know if there is any question regarding the code and if there is better way of doing it. Thanks /**CODE/ mx:RemoteObject id=amfSetup source=Setup destination=amfphp mx:method name=getList result=getListHandler(event); fault=getListFault(event);/ /mx:RemoteObject [Bindable] private var entriesXmlListFull:XMLList; [Bindable] private var entriesXmlCollection:XMLListCollection; public function getListHandler(event:ResultEvent):void { entriesXmlListFull = XML(event.result).device; populateEntries(); } private function getListFault(event:FaultEvent):void { Alert.Show(Error retreiving Data); } //Displaying names need to be displayed in the List box private function entriesLabelFunc(item:Object):String { var xmlItem:XML = item as XML; return xmlItem..attribute.(@name==friendlyname); } //Populating List with XML Objects private function populateEntries():void { entriesXmlCollection = new XMLListCollection(); for each(var item:XML in entriesXmlListFull) { var friendlyName:String = item..attribute.(@name==friendlyname); //Only add camera type if ( !recordValue hasFriendlyName (itemType.toUpperCase() == CAMERA) ) { entriesXmlCollection.addItem(item); } } //Calling Sort on XMLList collection entriesXmlCollection.sort = sortList; entriesXmlCollection.refresh(); } mx:Sort id=sortList mx:fields mx:SortField name=* caseInsensitive=true / /mx:fields /mx:Sort mx:List id=listData dataProvider={entriesXmlCollection} labelFunction=entriesLabelFunc/
Re: [flexcoders] Problem in sorting XMLList collection as a dataProvider for the list
Hi Thanks for replying What does we mean by custom sort compare function, Can we provide any examples of both sort and sort compare functions or little more details about what and how does we do that? Thanks much fro your help On Thu, Mar 5, 2009 at 11:24 AM, Alex Harui aha...@adobe.com wrote: If you have a labelfunction, you’ll probably need a custom sortcompare function Alex Harui Flex SDK Developer Adobe Systems Inc. http://www.adobe.com/ Blog: http://blogs.adobe.com/aharui *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On Behalf Of *anuj181 *Sent:* Wednesday, March 04, 2009 3:51 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] Problem in sorting XMLList collection as a dataProvider for the list Hi Guys I am trying to sort the xmllist collection which is the dataprovider for the list. As the implementation of name-value pairs, i am displaying the entries in form of string in List and would like to sort all the data displayed in the List alphabetically, I am making a call through amfphp call to grab data from backend and populate XMLListCollection but now I need to sort the data in the list. Below is the code,Can anyone please help me where I am messing things up. Also please let me know if there is any question regarding the code and if there is better way of doing it. Thanks /**CODE/ mx:RemoteObject id=amfSetup source=Setup destination=amfphp mx:method name=getList result=getListHandler(event); fault=getListFault(event);/ /mx:RemoteObject [Bindable] private var entriesXmlListFull:XMLList; [Bindable] private var entriesXmlCollection:XMLListCollection; public function getListHandler(event:ResultEvent):void { entriesXmlListFull = XML(event.result).device; populateEntries(); } private function getListFault(event:FaultEvent):void { Alert.Show(Error retreiving Data); } //Displaying names need to be displayed in the List box private function entriesLabelFunc(item:Object):String { var xmlItem:XML = item as XML; return xmlItem..attribute.(@name==friendlyname); } //Populating List with XML Objects private function populateEntries():void { entriesXmlCollection = new XMLListCollection(); for each(var item:XML in entriesXmlListFull) { var friendlyName:String = item..attribute.(@name==friendlyname); //Only add camera type if ( !recordValue hasFriendlyName (itemType.toUpperCase() == CAMERA) ) { entriesXmlCollection.addItem(item); } } //Calling Sort on XMLList collection entriesXmlCollection.sort = sortList; entriesXmlCollection.refresh(); } mx:Sort id=sortList mx:fields mx:SortField name=* caseInsensitive=true / /mx:fields /mx:Sort mx:List id=listData dataProvider={entriesXmlCollection} labelFunction=entriesLabelFunc/
[flexcoders] Problem with Sorting
Hey everyone, I have an array collection of Industry objects which are all sub-industries. Each industry object has as a property a parent industry (of datatype Industry); Industry VO contains properties: industryId : int; parent : Industry; name : String; I want to sort the array by the parent industry first, and then the children industries names. I was going to do something like: var sort : Sort = new Sort(); sort.fields = [ new SortField(parent.name, true), new SortField(name, true) ]; ...but this isn't working. Is there any way of going deeper than just immediate properties for a sortfield? Brennan -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
RE: [flexcoders] Problem with Sorting
The SortField objects take the name of the field in the object to be sorted as a String so your dot _expression_ will not work. What you can do is write a custom compareFunction for your Sort object. A compareFunction takes two objects and returns -1, 0, or 1 depending on which order the two objects should be sorted. The ASDoc for Sort.compareFunction has the function signature and a good example so check that out for more info. Your custom compareFunction can access top-level and sub-properties on each object and then sort accordingly. -deepa From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of dreuimar Sent: Thursday, August 31, 2006 9:44 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Problem with Sorting Hey everyone, I have an array collection of Industry objects which are all sub-industries. Each industry object has as a property a parent industry (of datatype Industry); Industry VO contains properties: industryId : int; parent : Industry; name : String; I want to sort the array by the parent industry first, and then the children industries names. I was going to do something like: var sort : Sort = new Sort(); sort.fields = [ new SortField(parent.name, true), new SortField(name, true) ]; ...but this isn't working. Is there any way of going deeper than just immediate properties for a sortfield? Brennan __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Software development tool Software development Software development services Home design software Software development company YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___