cancel
Showing results for 
Search instead for 
Did you mean: 

Previous or Next button in Webdynpro Java NWDS 7.3 or Footer Visible option

Former Member
0 Kudos

Hi All,

I have a requirement in a table where in i might have 600 records . I dont want to use the Scroll bar which is provided by table rather than that if the records exceeds more than 10 then i need to traverse to the next 10 records and so on. One option is using footer visible and traversing but i dont see any reflected changes when i make that true. Can i have a code snippet for the previous and next button if any one has worked on such requiremnt. Any help would be highly appreciated.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

ErvinSzolke
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

I remember there is a guide out there that exactly addresses your issue, but I don't find it so far.

Until I find it you can have a look at this:

http://scn.sap.com/people/bertram.ganz/blog/2008/11/27/web-dynpro-java-table-paging-unleashed-optimi...

Best Regards,

Ervin

ErvinSzolke
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

I don't find it so I rather write one.

Have a context like this:

Where

checkbox : boolean

text : string

counter : integer

firstvisible : integer

Initialize the context, say add 1000 Elements to the table:

public void wdDoInit()

  {

    //@@begin wdDoInit()

IPrivateCBoxCompView.ITabElement tab;

   for (int i =0;i<1000;i++) {

    tab = wdContext.nodeTab().createTabElement();

    tab.setCheckbox(false);

    tab.setText("text"+i);

    wdContext.nodeTab().addElement(tab);

   }

    //@@end

  }

Bind

- the node "tab" to your table UI element.

- the "counter" to a Label or Caption or TextView UI element you put on your layout

- the "firstVisible" to the firstVisibleRow in your Table UI element

I also changed the visibleRowCount to 10 because I want to have 10 rows on the screen in the table and I will page always 10 rows when pressing next or previous buttons.

Add 2 buttons one for Previous page one for the Next page, and specify the onAction() events of them this way:

public void onActionPrev(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

  {

    //@@begin onActionPrev(ServerEvent)

   wdContext.currentContextElement().setFirstvisible(wdContext.currentContextElement().getFirstvisible()-10);

   wdContext.currentContextElement().setCounter(wdContext.currentContextElement().getCounter()-1);

    //@@end

  }

Next:

public void onActionNext(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

  {

    //@@begin onActionNext(ServerEvent)

   wdContext.currentContextElement().setFirstvisible(wdContext.currentContextElement().getFirstvisible()+10);

   wdContext.currentContextElement().setCounter(wdContext.currentContextElement().getCounter()+1);

    //@@end

  }

It will look this way in runtime:

At the beginning right after invocation you see this:

Pressing Next couple of times:

Of course you have to add the code that makes sure you cannot go to page -1st or to page 100th, I did not add it here.

I hope this helps.

Regards,

Ervin

Former Member
0 Kudos

Hi Ervin,

Thanks a lot for providing the detailed solution . I tried it and its working perfectly fine.

I have also one more requirement where in i need to hide the scroll bar as i am already giving the paginator option. Can it be done in NWDS 7.3?

Thanks for the valuable answer.

ErvinSzolke
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

I knew that the next question would be to hide the scrollbar, but I am not sure it is possible unfortunately.

Maybe others can comment on it, what I know about this is that one cannot hide the scrollbar.

What you can do is that you don't use table, but create a "fake" table dynamically and handle the previous and next buttons in a different way. Later I try to implement a small solution for this and share this to you.

Best Regards,

Ervin

Answers (0)