Skip to Content
avatar image
Former Member

default sorting in table

Hi Experts,

I have a table which displays mdm data and i want the table to be sorted be default based upon a column when ever table screen is loaded.

Can some one help me with steps what to do and how to use or change the tablesorter class for this requirement

Thanks,

Anusha

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Jan 04, 2013 at 12:01 PM

    Hello Anusha,

    1.Go to the Table Propertiessort.JPG

    Table--->table column---->sortstate-->

    2.Create one context attribute type with TableSorter

    3.add TableSorter.java file under src/packages/util

    http://wiki.sdn.sap.com/wiki/display/devchallenge/TableSorter.java+For+WebDynpro

    4.add the below code in the wddomodify view

    if (firstTime){

            IWDTable documentListTable = (IWDTable) view.getElement("<table id>");

            wdContext.currentContextElement().setTableSorter(

            new TableSorter(documentListTable, wdThis.wdGetSortDocumentListAction(), null, new String[] { "<column name>" }));

           

            wdContext.currentContextElement().getTableSorter().sort_force("<column name>","sortstate",wdContext.nodeIt_Docs());

           

            wdContext.currentContextElement().setTableSorter(

                    new TableSorter(documentListTable, wdThis.wdGetSortDocumentListAction(), null));

            wdContext.currentContextElement().setRows(0);

    Regards,

    Manivannan P

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      If you follow the above steps it should be an sort state. Please check once again.

      Please check the code in wdDomodifyiew again

      Syntax:

          wdContext.currentContextElement().getTableSorter().sort_force("<column name>","sortstate",wdContext.nodeIt_Docs());

      Eg:

      wdContext.currentContextElement().getTableSorter().sort_force("Status","up",wdContext.nodeIt_Docs());

      also define in the Table column property-->sortstate

      Regards,

      Manivannan P