Hi,

I am trying to implement dataview:


final IDataProvider<PostDomain> postDomainDataProvider = new
IDataProvider<PostDomain>() {
                        
                        /**
                         * 
                         */
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void detach() {
                                // TODO Auto-generated method stub
                                
                        }
                        
                        @Override
                        public int size() {
                                // TODO Auto-generated method stub
                                System.out.println("Data view size called");
                                try {
                                        return list.size();
                                } catch (Exception exception) {
                                        // TODO Auto-generated catch block
                                        exception.printStackTrace();
                                        return 0;
                                }
                        }
                        
                        @Override
                        public IModel<PostDomain> model(final PostDomain 
object) {
                                // TODO Auto-generated method stub
                                return new 
LoadableDetachableModel<PostDomain>() {
                                        
                                        /**
                                         * 
                                         */
                                        private static final long 
serialVersionUID = 1L;

                                        @Override
                                        protected PostDomain load() {
                                                return object;
                                        }
                                };
                        }
                        
                        @Override
                        public Iterator<? extends PostDomain> iterator(int 
first, int count) {
                                // TODO Auto-generated method stub
                                System.out.println("Dataview iterator called");
                                try {
                                        return getList(count, first).iterator();
                                } catch (PostNotFoundException 
postNotFoundException) {
                                        postNotFoundException.printStackTrace();
                                } catch (Exception exception) {
                                        // TODO Auto-generated catch block
                                        exception.printStackTrace();
                                }
                                return null;
                        }
                };


Now what is happening is size() method is getting called many times before
dataView is rendered. There is                  no looping situation over
here and if there would be any infinite looping, then dataView wont have
rendered.
size() can return any thing from 0 to 100..and I have set
dataView.setItemPerPage(20).

What can be the reason? 



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/size-method-is-being-called-multiple-times-in-dataview-tp4651666.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to