on 05-18-2006 4:25 PM
Hi ,
We have developed Tree Table structure based on the tutorial, but the data in the columns are not in the right order. Can anyone tell me how to do column sorting for Tree table structure, I know how to do column sorting on normal table structure but that logic does not work for Tree table structures
Appreciate your help
Som
Hi Som,
If you are using TutWD_TreeByNestingTableColumn project as example, this code can help you:
//@@begin javadoc:onActionSortTree(ServerEvent)
/** Declared validating event handler. */
//@@end
public void onActionSortTree(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionSortTree(ServerEvent)
sort(wdContext.nodeCatalogEntries());
//@@end
}
private void sort(IPrivateTreeTableView.ICatalogEntriesNode catalogEntriesNode) {
if(null==catalogEntriesNode) return;
catalogEntriesNode.sortElements(COMPORATOR);
int size = catalogEntriesNode.size();
for(int i=0;i<size;i++) {
sort( catalogEntriesNode.nodeChildCatalogEntries(i) );
}
}
private static final Comparator COMPORATOR = new CatalogEntriesComparator();
private static class CatalogEntriesComparator implements Comparator {
public int compare(Object o1, Object o2) {
IPrivateTreeTableView.ICatalogEntriesElement ot1 = (IPrivateTreeTableView.ICatalogEntriesElement)o1;
IPrivateTreeTableView.ICatalogEntriesElement ot2 = (IPrivateTreeTableView.ICatalogEntriesElement)o2;
return Collator.getInstance().compare( ot1!=null ? ot1.getTITLE() : "",
ot2!=null ? ot2.getTITLE() : "");
}
public boolean equals(Object obj) {
return false;
}
}
Best regards, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Som,
Hi Gregory,
"Must read" for Tree-in-table users:
/people/valery.silaev/blog/2005/06/13/master-of-columns-part-i
/people/valery.silaev/blog/2005/06/20/master-of-columns-part-ii
Best regards, Maksim Rashchynski.
Valery Silaev
Posts: 1,549
Questions: 16
Forum Points: 3,269
Registered: 3/3/04
Re: Integration of a Tree Structure in a Web DynPro Table
Posted: Feb 15, 2006 9:33 AM Reply E-mail this post
Gregory,
1. Either in hard way, read this: /people/valery.silaev/blog/2005/06/20/master-of-columns-part-ii
2. If you have SP13+ version, then you may add source mapping for onLeadSelect action, same as for onLoadChildren in blog mentioned above, the only differens is wdDoModifyView:
if ( firstTime )
{
...
final IWDTable tblEntries = (IWDTable)view.getElement("<table-id>");
tblEntries.mappingOfOnLeadSelect().addSourceMapping
(
"nodeElement",
"<name-of-param-in-action-handler>"
);
}
Thanks,
Raj.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.