3.2.0

Sorting Columns with XML CDATA content

Hi all, Hi Alex,
we currently evaluating AW for a big project. But we have a major problem with the sort behaviour of AW and didn't find a solution. I nearly read the whole support forum but didn't find any answers.

The Problem:

we use a grid loaded with data from an XML File like

<list>
<row>
<cell1><![CDATA[<a href='http://somelink.com'>123</a>]]></cell1>
</row>
<row>
<cell2><![CDATA[<a href='http://otherlink.com'>456</a>]]></cell2>
</row>
</list>

sorting becomes a big issue here.
we want to sort this column numeric but can't set the type numeric as there is some text in the cells.
so the sorting wil be alpha numeric but we ned sorting it numeric.

someone mentioned somewhere to use a hidden column for sorting. but how to achieve this ?

if we use:

<list>
<row>
<cell1><![CDATA[<a href='http://somelink.com'>123</a>]]></cell1>
<hiddencell1>123</hiddencell1>
</row>
<row>
<cell2><![CDATA[<a href='http://otherlink.com'>123</a>]]></cell2>
<hiddencell1>456</hiddencell1>
</row>
</list>

we now want the column 1 sorted by column 2 by clicking on header of column 1.
is this possible and how?

thx a lot

rgs

jan
jan
November 24,
I guess you just need a custom format based on 'number' but which also removes html tags before sorting -

var custom = new AW.Formats.Number;

custom.dataToValue = function(data){
    return Number(data.replace(AW.htmlPattern, AW.htmlReplace));
};

custom.dataToText = function(data){
    return data; // bypass dataToValue conversion
};
Alex (ActiveWidgets)
November 24,
Thank you so much !!!
That was exactly the hint i need to fix the sorting. By reading some more manuals i can achieve a perfect solution for us.

No we can continue our evaluation process.
jan
November 24,

This topic is archived.

See also:


Back to support forum