on 09-23-2013 12:14 PM
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
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:
Best Regards,
Ervin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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);
}
}
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);
}
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);
}
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
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
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.