cancel
Showing results for 
Search instead for 
Did you mean: 

create a custom IWDCustomEvent

0 Kudos

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?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

0 Kudos

hi,

works fine! thanks!

Answers (1)

Answers (1)

Former Member
0 Kudos

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