on 03-05-2008 7:28 AM
Hi,
in a WD Table i have a column that contains boolean values, and this bools are dislayed by two icons (calculated attributes that give back the file "yes.gif", "no.gif").
And i have to sort this values.
Is it possible??
The other columns have StringValues, and are sorted with the TableSorter-Class posted in blog.
Regards,
Bernhard
Edited by: Bernhard Derks on Mar 5, 2008 8:29 AM
IIRC the TableSorter class offers the possibility to pass explicit comparators for table columns. Implement a comparator for the icon column that compares two node elements according to the boolean value that defines the icon and pass this comparator to the TableSorter.
Something like
Context
+ Rows (node)
+ booleanValue (boolean)
+ icon (string)
Comparator compareRowsByBooleanValue = new Comparator()
{
public int compare(Object x, Object y)
{
IRowsElement rx = (IRowsElement) x;
IRowsElement ry = (IRowsElement) y;
if (rx.getBooleanValue() == ry.getBooleanValue())
return 0;
return rx.getBooleanValue() ? -1 : +1;
}
}
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bernhard,
I have an Idea. Why don't you have one more attribute in the table node of string type carrying "0" for false and "1" for true which should be set while setting the images in the boolean column. Now onAction (instead of onSort as we don't have any for the column) use the code for context node-sorter based on this string attribute.
For node-sorting of attributes not bound to the table follow the link where Node Sorter class is given. Also, how to call it in your web dynpro application for sorting based on particular attribute is given.
[Context Node Sorting|http://wiki.sdn.sap.com/wiki/display/Snippets/SortingContextNode]
I know it is not the exact solution but of course is the closest match I can see. The only difference would be we wont have sorting icon next to the column header for sorting. Instead you would have to just click the column header. What do you say?
Regards,
Tushar SInha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
have you solved ??
I have same problem...
thanks!
Roberto
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi bernhard,
U can check this.Here he is using it for filter but u can try for sort as well.few things need to be changed.
/people/peter.vignet/blog/2007/01/03/generic-web-dynpro-java-table-filter
regards
Sumit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can do this by making use of your own comparator.
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.