>Could you explain this? Make an example?

Nothing exciting  ... I am doing a count of the resultSet (outside dbforms)
and setting a hidden html 'position' element. Whenever a user hits 'next' or
'previous' button I decrease or increase 'position'  accordingly. When
'position'=0 I don't display NavFirst, NavPrev buttons and  when
'position'='dataCount' I don't display NavNext, NavLast buttons. Something
like:

<% int position = StdLib.parseInt(request.getParameter("lastPosition")); %>
  
<db:dbform  tableName="data_table" 
   maxRows="1" 
   followUp="<%=updateTableData%>" 
   redisplayFieldsOnError="true" 
   autoUpdate="false"
   captionResource="true">    

<% request.setAttribute("rsv_data_table",rsv_data_table); 
int dataCount = StdLib.parseInt(request.getAttribute("dataCount"));
%>

      <db:isWebEvent event="navFirst" value="true"><% position=0;
%></db:isWebEvent>  
       <db:isWebEvent event="navPrev" value="true"> 
         <% position=(position < 0)?0:position-2;position=(position <
0)?0:position; %>
     </db:isWebEvent>   
       <db:isWebEvent event="navNext" value="true"><% position++;
%></db:isWebEvent> 
       <db:isWebEvent event="navLast" value="true"><% position=(dataCount >
0)?dataCount-2:position; %></db:isWebEvent>  
    
<% request.setAttribute("position", new Integer(position)); %>              
 
 <table align="center" border="0">
    <tr>
  <c:choose>
    <c:when test="${!empty rsv_data_table && position > 0}">
        <db:isWebEvent event="navFirst" value="false"> 
         <td><db:navFirstButton caption="button.nav.first"
style="width:90"/></td>
     </db:isWebEvent>
        <td><db:navPrevButton caption="button.nav.previous"
style="width:90"/></td>    
          </c:when>
    </c:choose> 
    
  <c:choose>      
      <c:when test="${!empty rsv_data_table && position < dataCount}">
        <td><db:navNextButton caption="button.nav.next"
style="width:90"/></td>
        <db:isWebEvent event="navLast" value="false"> 
         <td><db:navLastButton caption="button.nav.last"
style="width:90"/></td>
     </db:isWebEvent> 
    </c:when>
  </c:choose>     
    </tr>
</table>

> -----Original Message-----
> From: Henner Kollmann [SMTP:[EMAIL PROTECTED]]
> Sent: 20 February 2003 10:27
> To:   'J M Okomba'
> Cc:   dbf
> Subject:      AW: [dbforms] NavFirst, NavPrev,NavNext, NavLast - Buttons
> 
>  
> > 
> > 
> > This would be very useful. I have had to manipulate the data 
> > retrieved to achieve this, often with inconsistent result. 
> Could you explain this? Make an example?
> 
> > BTW on a similar note, how can someone do pagination in 
> > dbforms. The tag <db:pos /> give position relative to the 
> > ResulsetVector. I would like to get the position of the 
> > record in the table. If we can get the first and last records 
> > can we get the position of other records, and add a tag to 
> > display the position?
> Last record is imposible! I added an attribute for the first row in a
> new recordset to build the mentioned.
> 
> Position relative to the first row is impossible in the current
> implementation. Shall we discuss the changing of the resultsetvector
> again which was suggested by Luca somtime ago? With this model position
> relative to first row will work.
> 
> Regards,
> Henner
> 
> 


-------------------------------------------------------
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
The most comprehensive and flexible code editor you can use.
Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
www.slickedit.com/sourceforge
_______________________________________________
DbForms Mailing List

http://www.wap-force.net/dbforms

Reply via email to