on 11-02-2006 2:33 PM
Hi all,
i've read the article about table enhancement and tablesorter, and i'm wondering, is it possible to sort a table on more than one column? I mean the following:
1|2
-|-
X|A
X|B
Y|C
X|C
Y|B
Y|A
...
What i can achieve with this table, is to sort on column COL1, or on COL2, but what i want to achieve is that i sort on COL 1 and then again, sort the result on COL2. The result will be:
1|2
-|-
X|A
X|B
X|C
Y|A
Y|B
Y|C
...
Is this currently possible?
Kind regards,
Joren
Message was edited by: Joren Crauwels
Hi Joren
Of course you can implement your own Java Comparator and use it to sort the table elements by two or more columns at the same time.
IWDNode.sortElements(Comparator);
However it will be appreciated only if you do not need to provide end-user with a possibility to select the two or more columns for sorting dynamically. It seems WebDynpro does not allow to select more than one columns at the same time on UI. The only user can do is to click on titles of each columns separately. How do you imagine the feature from point of view of end-user?
BR
Sergei
Message was edited by: Siarhei Pisarenka
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Sergei,
thx for you reply.
I know that u can sort on multiple columns through the use of a comparator. But like u say, that's only for one column at a time. What i would want to make possible for the user, is that he can sort on column A and while preserving that sorting order, he can additionally sort on column B.
I want to make possible that he can sort on as many columns at a time he wants.
like in SAP R3 u can do with an internal table, for example:
sort itab by col1 ascending col2 descending.
Kind regards,
Joren
Message was edited by: Joren Crauwels
Joren,
<i>I know that u can sort on multiple columns through the use of a comparator. But like u say, that's only for one column at a time.</i>
Using Comparator it is possible to sort by multiple attributes, try my solution:
The "usage" at the bottom of post shows how to sort by multiple attributes.
Valery Silaev
SaM Solutions
Thx alot valery.
How did u implement the use of your code?
With this i mean, Is it possible to select multiple columns while holding the CTRL-key or how? And is it possible to know the order in which the columns are selected, or do I have to keep track of this myself in some way? (to know the sorting order)
Kinds regards,
Joren
Message was edited by: Joren Crauwels
I found a workable solution.
I can sort on multiple columns now (or just on one, depending on what the user wants at runtime), using the standard Web Dynpro sort mechanism and the code of Valery. The columns are sorted and the sorting-icons in the header of the column visualize the sorting order (up, down, or none)
If someone needs an idea about how this can be down, feel free to contact me.
Kind regards,
J.
Hi Armin, Joren,
I am using the table sorter class for multiple columns.
this class involves three more classes.
1)GenericNodeElementComparator
2)OrderingAttribute
3)OrderingExpression
I am using the following code to sort my node.
ABCNode.sortElements(
new GenericNodeElementComparator(
new OrderingExpression().asc("ele1").asc(
"ele2").desc(
"ele3")));
After sorting the lead selection of the node remains on the third row.
when i am trying to forcefully set the lead selection to first node by
ABCNode.setLeadSelection(0);
For display purpose the lead selection is set to the first column.
How ever when i fetch the node's element data using the code
ABCEle = ABCNode.getABCElementAt(wdContext.nodeABC().getLeadSelection(););
ABCEle.GetEle1();
it gives me the value of the third element and not the first element.
How can i set the node lead selection element to the first element?
Regards,
Ashish Shah
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.