setFirst() of TableRowGroup is not working for pagination

Vijay Shanker <[email protected]> Wed, 28 Nov 2007 16:12:44 -0800 (PST)
Newsgroups gmane.comp.java.netbeans.user-interface
Message-ID <[email protected]>
Hi,

I have requirement to see the page of table that has
row for the current date. I tried different approches
but nothing is working. I even tried to use setFirst
of TableRowGroup in prerender() and also in init()
method but it does not work.

I found out that after calling setFirst(), if I call
getFirst() then it returns still 0 while I am using
high value in setFirst(). Probably in starting of the
page, data provider is having some problem. My code
looks like below. Help will be highly appreciated.



            AccountMonthBean accntMonthBean = null;
            try {
            for(int i = 0; i < keyRows.length; i++) {
                accntMonthBean =
(AccountMonthBean)getObjectListDataProvider().getObject(keyRows[i]);
                // To do: Some time
cal.getTime().before(accntMonthBean.getEndDate() might
give wrong result if we access in night
               
if(currentCal.getTime().after(accntMonthBean.getStartDate())
&&
                       
currentCal.getTime().before(accntMonthBean.getEndDate()))
{
                   
getObjectListDataProvider().setCursorRow(keyRows[i]);
                   
tablePhaseListener.setSelected(keyRows[i],
accntMonthBean);
                    tableRowGroupAcctMonth.setFirst(i
- (i % 6));
                    System.out.println("Value of i: "
+ i);
                    System.out.println("Value of i -
(i % 6): " + (i - (i % 6)));
                    System.out.println("Value of
getFirst(): " + tableRowGroupAcctMonth.getFirst());
                    break;
                }              
            }   
            } catch (Throwable e) {
                System.out.println(e);
            }

Would appreciate for the help.

Vijay



      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs