on 03-08-2006 3:06 PM
Hey!
I got a table with some cols like Name, Changed, Status.
This resolves in a lot of rows, and it whould be perfect if the user could sort the rows after wich tableheader that was pressed.
I.E. a user press the column Name, it gets sorted on names, or if Changed is pressed, then its gets sorted on the dates.
Anyone got any clue of how this is possible?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
1)Adding TableSorter.java is simple in NWDS go to Navigator prespective paste the TableSorter.java file which you downloaded in the src->packes->the package which given for project.
2)Open the TableSorter.java file change the packge path.
just refersh and go to Web Dynpro prespective,
3)In the implemetation tab of the view add the sorce code which i mentioned
it will work, it worked for me..
Regards,
RK
Message was edited by: Ramakrishna Venkat
Hallo Kristoffer,
by default the TableSorter automatically makes all table columns sortable (i.e. all context attributes). You just have to use the first constructor which does not have the String array parameter (IDs of sortable columns).
public static void wdDoModifyView(
IPrivateWork wdThis, IPrivateWork.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
{
//@@begin wdDoModifyView
if (firstTime) {
IWDTable table = (IWDTable) view.getElement("CustomerTable");
wdContext.currentContextElement().setCustomerTableSorter(
new TableSorter(table, wdThis.wdGetSortCustomersAction(), null));
}
//@@end
}
Regards, Bertram
Hi,
you created Context attribute for table sorter.
see the properties of that context attribute-> select Java Native type Radio button-> Browse (give TavleSorter) it will automatically display-> the given path(FOlder structure) and TableSorter (ie. com.abc.xyz.TableSoret) select this as type.
rest is in implemetation tab(Source code)
hope this solved your problme
Regards,
RK
Hi,
1)create a context valueattribute in the viewcontex and assign the the following type:
com.sap.tc.webdynpro.tests.utils.TableSorter
2)create a Action in your view for example:sortbyDate
3)assign this action to the table column properties that has to be sorted: Event / onAction sortbyDate
4) go to the implementation tab of your view controler and assign this code to the Action onActionsortbyTable:
wdContext.currentContextElement().getTableSorter().sort(wdEvent, wdContext.nodeDeMaintenenceOverview()); this sorts all elements in the specified valuenode(assigned to the table)
regards
Martin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
First do this:
1.import the Tablesorter src/packages...
2. Switch to the Context tab page.
3. Using the secondary mouse button, click Context, choose New → Value Attribute, enter TableSorter as name, and confirm by pressing Finish.
4. Select the value attribute TableSorter and choose the type property in the lower window in the Properties tab.
5. Click the pushbutton , choose Java Native Type and enter com.sap.tc.webdynpro.tests.utils.TableSorter. Confirm choosing OK.
via this example code you can access the sorter:
if (firstTime) {
IWDTable table = (IWDTable) view.getElement("ShoppingBasket");
wdContext.currentContextElement().setTableSorter(
new TableSorter(table, wdThis.wdGetSortAction(), null));
}
and:
wdContext.currentContextElement().getTableSorter().sort(wdEvent, wdContext.nodeProducts());
You can use this URL to get a Tutorial on developing with tables. Pls use tutorial number 11 "Developing with tables"
regards
Martin Hastik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
Refer this web log
/people/bertram.ganz/blog/2006/03/07/enhanced-web-dynpro-java-tablesorter-for-sap-netweaver-04s
I worked for Copmany code Bapi
1) In a table i displayed Company code (1st Cloumn) and Company Name (2nd Column) by excuting bapi in component controller
2) in View
public static void wdDoModifyView(IPrivateVI_TCompareView wdThis, IPrivateVI_TCompareView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
{
//@@begin wdDoModifyView
if (firstTime) {
IWDTable table = (IWDTable) view.getElement("CompanyTable"); <b><----- [CompanyTable Table UI Name]</b> wdContext.currentContextElement().setSortCompanyName(
new TableSorter(
table,
wdThis.wdGetSortByCompanyNameAction(),
null));
}
//@@end
}
//@@begin javadoc:onActionsortByCompanyName(ServerEvent)
/** Declared validating event handler. */
//@@end
public void onActionsortByCompanyName(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionsortByCompanyName(ServerEvent)
wdContext.currentContextElement().getSortCompanyName().sort(
wdEvent,
wdContext
.nodeBapi_Companycode_Getlist_Input()
.nodeOutput()
.nodeCompanycode_List());
//@@end
}
hope this solves your problem
Regards,
RK
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.