Scroll to specified row number

In this post we see how to scroll to specified row number in a table.

Method 2 : As shown below

I am making use of employee table from hr schema which is having > 100 records, it is not essential that a table should have more then 100 records in this demo. However UI Page looks some thing like this. A input text field accepts row number from users and custom action binded to Go button which executes to scroll vertical bar on table to specified row number and this method has code some thing like this.Key API is setDisplayRowKey(Key)

Go action method in backing bean.

    public String showRowKey_action() {
        // Add event code here...
        String st = this.getInputtxt().getValue().toString();
        this.getTable().setRowIndex(Integer.parseInt(st));
        Object newKey = this.getTable().getRowKey();
        this.getTable().setDisplayRowKey(newKey);
        return null;
    }


Before scroll vertical scroll bar at record 1


displayRowKey1.PNG


























After entering row number say 30 and clicking go button shits vertical scroll bar to 30th record.


displayRowKey2.PNG

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

bocadmin_ww

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today