Wicket Custom Pagination -
i have been trying trying implement
<< < (textbox) of (totalnumberofpages) > >>
any suggestions on
thanks in advance...
if looking pagination in dataview ,all need enable paging call setitemsperpage(int) on dataview.
check following example java code
public class repeatingpage extends basepage { private static final long serialversionuid = 1l; /** * constructor */ public repeatingpage() { iterator<contact> contacts = new contactdataprovider().iterator(0, 10); repeatingview repeating = new repeatingview("repeating"); add(repeating); int index = 0; while (contacts.hasnext()) { abstractitem item = new abstractitem(repeating.newchildid()); repeating.add(item); contact contact = contacts.next(); item.add(new actionpanel("actions", new detachablecontactmodel(contact))); item.add(new label("contactid", string.valueof(contact.getid()))); item.add(new label("firstname", contact.getfirstname())); item.add(new label("lastname", contact.getlastname())); item.add(new label("homephone", contact.gethomephone())); item.add(new label("cellphone", contact.getcellphone())); final int idx = index; item.add(attributemodifier.replace("class", new abstractreadonlymodel<string>() { private static final long serialversionuid = 1l; @override public string getobject() { return (idx % 2 == 1) ? "even" : "odd"; } })); index++; } } }
html code
<wicket:extend xmlns:wicket="http://wicket.apache.org"> <br/><br/> <table cellspacing="0" class="dataview"> <tr> <th>actions</th> <th>id</th> <th>first name</th> <th>last name</th> <th>home phone</th> <th>cell phone</th> </tr> <tr wicket:id="repeating"> <td><span wicket:id="actions">[actions]</span></td> <td><span wicket:id="contactid">[contactid]</span> </td> <td><span wicket:id="firstname">[firstname]</span></td> <td><span wicket:id="lastname">[lastname]</span></td> <td><span wicket:id="homephone">[homephone]</span></td> <td><span wicket:id="cellphone">[cellphone]</span></td> </tr> </table> </wicket:extend>
if need pagination in listview check pageablelistview
Comments
Post a Comment