on 02-27-2008 8:06 AM
hi everyone,
im using the TableFilter and TableSorter-Classes on my table and i want to sort them at the application-startup (in wdmodifyview-firsttime).
but the TableSorter-sort-function uses as IWDCustomEvent to get the column which should be sorted.
public void sort(IWDCustomEvent wdEvent, IWDNode dataSource) {
// find the things we need
String columnId = wdEvent.getString("col");
my question is, how to create a new IWDCustomEvent element and how to set the "col" string?
Hi,
You can directly call the sortElements() method on the node bound to the table on application startup. You can ofcourse reuse the comparator defined in the TableSorter class, like so
//@@begin wdDoModifyView
if (firstTime) {
IWDTable table = (IWDTable) view.getElement("<TableID>");
wdContext.currentContextElement().setCustomerTableSorter(
new TableSorter(table, wdThis.wdGetSortCustomersAction(), null, new String[] { "attribute_name" }));
wdContext.nodeTable().sortElements(wdContext
.currentContextElement()
.getCustomerTableSorter()
.new NodeElementByAttributeComparator("attribute_name")
);
}
//@@end
Regards,
Satyajit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Constantin,
It is impossible to create IWDCustomEvent.
If you want to sort your data on startup then you definitely should know the name of the column for sorting and sorting direction (default values). As far as you need IWDCustomEvent only to receive column id and sorting direction you can omit it and write custom code in doModifyView to sort you data (something like sort in TableSorter or as Satyajit suggested to you)
Regards
Pavel
Edited by: Pavel Yadrikhinskiy on Feb 27, 2008 4:23 AM
Edited by: Pavel Yadrikhinskiy on Feb 27, 2008 4:24 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.