Any one can show me the direction of how to use Paging? Thank yopu 2012/1/23 Daniel Mauricio Patino León <ceo.lion....@gmail.com>
> Hello everyone. > > I dont understan how paging works, and i cant get a SimplePaging get > work with my example. > > I have a CellTable whit my own AsyncDataProvider: > > public class PersonDataProvider extends > AsyncDataProvider<PersonProxy> { > > private final PersonRequestFactory requestFactory; > > public PersonDataProvider(PersonRequestFactory requestFactory) { > super(null); > this.requestFactory = requestFactory; > } > @Override > protected void onRangeChanged(final HasData<PersonProxy> display) { > final Range range = display.getVisibleRange(); > final int start = range.getStart(); > /* not used insted use > display.getVisibleRange().getLength() as MAX > values*/ > final int end = start + range.getLength(); > > > > requestFactory.personRequest().getAllPersons(start,display.getVisibleRange().getLength()).with("pet").fire(new > Receiver<List<PersonProxy>>(){ > @Override > public void onSuccess(List<PersonProxy> response) { > /* what should i have here? */ > updateRowData(start, response); > } > }); > } > > @Override > public void addDataDisplay(HasData<PersonProxy> display) { > super.addDataDisplay(display); > // Request the count anytime a view is added. > requestFactory.personRequest().countPersons().fire(new > Receiver<Long>(){ > public void onSuccess(Long response) { > // the total count from server > updateRowCount(response.intValue(), true); > } > }); > } > } > > > Then i got in my DataAccesObject: > > public List<Person> getAllPersons(int start,int max){ > Session session = > HibernateUtil.getSessionFactory().openSession(); > Transaction tx = null; > try { > tx = session.beginTransaction(); > > System.out.println(" limit "+start+",5"); > @SuppressWarnings("unchecked") > List<Person> persons = > > session.createCriteria(Person.class).addOrder(Order.desc("myAge")).setFirstResult(start).setMaxResults(max).list(); > > System.out.println("List size "+persons.size()); > > tx.commit(); > return persons; > } catch (RuntimeException e) { > if (tx != null) > tx.rollback(); > throw e; > } finally { > session.close(); > } > } > > > But i cant it work the paging isn't show me the right berhaivor. > > How can i use SimplePager with Hibernate on the server Side. > > Thank you. > > -- > You received this message because you are subscribed to the Google Groups > "Google Web Toolkit" group. > To post to this group, send email to google-web-toolkit@googlegroups.com. > To unsubscribe from this group, send email to > google-web-toolkit+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > > -- ISC. Daniel Mauricio Patiño León. Director ejecutivo Liondev S.A. de C.V. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.