Hello world !
In your ZMI, you can add a "Z Search interface", 
where you select your "ZSql method".
You have a radio button "Generate page template", 
you'll see the code generated for multi-pages :
it looks like that (for my application) :

<div metal:define-macro="listemaires">
  <body tal:define="results  here/select_maires;
                    start request/start|python:0;
                    batch python:modules['ZTUtils'].Batch(results, 
                                                          size=20, 
                                                          start=start);
                    previous python:batch.previous;
                    next python:batch.next">

  <p>
    <a tal:condition="previous"
       tal:attributes="href
string:${request/URL0}?start:int=${previous/first}"
       href="previous_url">previous <span
tal:replace="previous/length">20</span> results</a>
    <a tal:condition="next"
       tal:attributes="href string:${request/URL0}?start:int=${next/first}"
       href="next_url">next <span tal:replace="next/length">20</span>
results</a>
  </p>

  <table border>
        <tr>
          <th>Id</th>
          <th>Communes</th>
          <th>N canton</th>
          .........
          .........


After the </table>, you have :

  <p>
    <a tal:condition="previous"
       tal:attributes="href
string:${request/URL0}?start:int=${previous/first}"
       href="previous_url">previous <span
tal:replace="previous/length">20</span> results</a>
    <a tal:condition="next"
       tal:attributes="href string:${request/URL0}?start:int=${next/first}"
       href="next_url">next <span tal:replace="next/length">20</span>
results</a>
  </p>

  </body>
</div>

"select_maires" is my zsql method.
It runs on Fedora and Red Hat, CPS 3.2.4, python 2.3.4

Patrick Maynard.



Message: 1
Date: Fri, 26 Jan 2007 14:37:24 +0100 (CET)
From: Graziella Toutoungis <[EMAIL PROTECTED]>
Subject: [CPS-users] batch next previous
To: [email protected]
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=iso-8859-1

hello,

I have a page template for showing the result of a
table. i want to do a next and a previous button.
some body can help me i tried some batch code but with
no success.

my table is
<table border="1" align="center" width="100%"
cellspacing="0" cellpadding="2">
 <tbody>
 <tr bgcolor="#ece9d8"> 
 <th>id</th>
 <th>customer</th>
 <th>phone</th>

 </tr>
 <tr align="right" bgcolor="#ffffff" tal:repeat="items here/ref_zsql"> 
 <td align="left" tal:content="items/id">id</td>
 <td align="left" tal:content="items/name">name</td>
 <td align="left" tal:content="items/phone"></td>
 </tr>
 </tbody>
 </table>
thanks
 G.




        

        
                
___________________________________________________________________________ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !

Profitez des connaissances, des opinions et des expériences des internautes
sur Yahoo! Questions/Réponses 
http://fr.answers.yahoo.com


------------------------------

_______________________________________________
cps-users mailing list
[email protected] http://lists.nuxeo.com/mailman/listinfo/cps-users


End of cps-users Digest, Vol 42, Issue 6
****************************************
_______________________________________________
cps-users mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/cps-users

Reply via email to