Hi Jason,
Thanks for the reply and the suggestion.
However I don't think this deals with the ascending and descending sort
cases does it? I changed your example slightly so that
if (obj1.summaryRow)
return 1
else if (obj2.summaryRow)
return -1
i.e. the signs are reversed. So now when you do the initial sort the summary
row stays as the last row. However if the user sorts that column again then
the sort order is reversed, and the summary row moves to the first row. Am I
missing a simple way to resolve this?
Thanks again,
Dan.
Pan Troglodytes wrote:
>
> Yes, it's fairly easy to do with a custom sort function. Here is an
> example
> function that assumes you set a "summaryRow" property on the last row
> object:
>
> private function compareWithSummary(obj1:Object, obj2:Object):int
> {
> if (obj1.summaryRow)
> return -1
> else if (obj2.summaryRow)
> return 1
> else if (obj1.fieldbeingsorted < obj2.fieldbeingsorted)
> return -1
> else if (obj1.fieldbeingsorted > obj2.fieldbeingsorted)
> return 1
> else
> return 0;
> }
>
> Where "fieldbeingsorted" is the field for that column that would otherwise
> be sorting on. For example, if you had
>
> <AdvancedDataGrid dataField="customerName"
> sortCompareFunction="copmareWithSummary"/>
>
> then fieldbeingsorted would be customerName. You'd need to make a
> different
> compare function for each column in the grid, since Flex doesn't pass in
> the
> column name to the sort compare function.
>
> On Fri, Sep 12, 2008 at 10:21 AM, DanMurray <[EMAIL PROTECTED]> wrote:
>
>>
>> Hi,
>>
>> I have an AdvancedDataGrid where the last row contains some summary
>> information about the data (number of rows, totals for some of the
>> columns
>> above). I would like to exclude this last row from the sort operations
>> i.e.
>> always show it last - is there any way to achieve this with custom
>> sorting?
>>
>> (Prev posted to flex-india group my mistake - apologies)
>>
>> Thanks,
>>
>> Dan.
>> --
>> View this message in context:
>> http://www.nabble.com/AdvancedDataGrid%3A-Exclude-last-row-from-sorting-tp19458035p19458035.html
>> Sent from the FlexCoders mailing list archive at Nabble.com.
>>
>>
>>
>
>
>
> --
> Jason
>
>
--
View this message in context:
http://www.nabble.com/AdvancedDataGrid%3A-Exclude-last-row-from-sorting-tp19458035p19497738.html
Sent from the FlexCoders mailing list archive at Nabble.com.