History | Log In     View a printable version of the current page.  
Issue Details (XML)

Key: SDK-14663
Type: Minor Enhancement Minor Enhancement
Status: Closed Closed
Resolution: Deferred
Priority: C C
Assignee: Robert Vollmar (Adobe)
Reporter: Henk
Votes: 1
Watchers: 4
Operations

If you were logged in you would be able to see more operations.
Flex SDK

Add attribute to set the default sort column in a datagrid

Created: 02/16/08 06:13 PM   Updated: 02/20/08 02:35 PM
Component/s: mx: DataGrid
Security Level: Public (All JIRA Users )

File Attachments: 1. File SortExample.mxml (1 kb)
2. File SortingExample2.mxml (2 kb)

Image Attachments:

1. case insensitive.jpg
(5 kb)

2. case sensitive.jpg
(5 kb)

Severity: Non Functioning
Reproducibility: Every Time
Discoverability: High
Found in Version: SDK Moxie RC3
Affected OS(s): All OS Platforms - All
Steps to Reproduce:
In using a DataGrid it is often desirable to set an initial sort column.

The documentation suggests to sort the data provider. The problem with this solution is that it requires addition code, does not leverage existing functionality of sorting a column, and does not show the sort indicator in the sorted column.

Please add an attribute to the datagrid that sets the sort column.
Developers should be able to set and modify this attribute programatically.
Language Found: English
Bugbase Id: none
Triaged: Yes
Regression: No
QA Owner: Robert Vollmar (Adobe)
Resolved by: Lauren Park
Participants: Henk, Lauren Park, Robert Vollmar (Adobe) and Samuel


 All   Comments      Sort Order:
Samuel - [02/18/08 06:47 AM ]
I think so too.

Another reason :
To sort manually the data provider doesn't give the same résult as the default datagrid's sorter.
For example, when I sort a String column myself, It ignores case. When the datagrid sorts a String column, it sorts upper case first, and then lower case. So if I initialize by sorting myself the data provider and then, the user clic on the column header, he doesn't see the same result !!!

So it causes some "bizarre" incoherences...

Thanks

Robert Vollmar (Adobe) - [02/19/08 12:32 PM - edited ]
I've uploaded an example of how to do this (SortExample.mxml) with screen shots. I'll start by saying I agree with the enhancement request (minor), but would like to comment on some of the individual statements made so far:

1) "it requires addition code": See the sample code; this can be done in a few lines.
2) "does not show the sort indicator in the sorted column": See the sample code and screen shots. If it doesn't for you, please attach sample code.
3) "when I sort a String column myself, It ignores case": See the sample code to see how to affect case sensitivity.
4) "To sort manually the data provider doesn't give the same result as the default datagrid's sorter.": If this happens in other ways besides the case sensitivity issue, can you let us know? Also, you can specify the sort function of a DataGridColumn if you want it to sort different than the DataGrid's default way.

This won't make it into 3.0 because we're locked down, so please attach code, make comments, and let me know if you need any help with this.
Thanks,
- Rob

Robert Vollmar (Adobe) - [02/19/08 12:37 PM ]
Sending to IRB. Recommend for deferral.

Samuel - [02/20/08 08:14 AM ]
Try to do it on a multi-colums datagrid.
Place this "custom" sorter on the first column to sort without case sensitive (like the first image)
Launch it.
Click on the second column header to sort it
Click back to the first column header
Then you can see that the sort order is case sensitive.

So, users are desapointed. They first had a case insensitive sort order, and 2 clics later, they have a case sensitive sort order for the same column...

Am I wrong ?

Robert Vollmar (Adobe) - [02/20/08 10:35 AM ]
Taking the example one step further, to make the DataGrid always deviate from its default sorting behavior when clicking on a column header, specify the sortCompareFunction of a DataGridColumn. it must specify a function with the signature:

mySortCompareFunction(obj1:Object, obj2:Object):int

See SortingExample2.mxml, which has a DataGridColumn with a sortCompareFunction which reuses the doSort() function that was initially used.

Lauren Park - [02/20/08 02:19 PM ]
Deferred.