Read about dynamic models at
http://cwiki.apache.org/WICKET/working-with-wicket-models.html

On Thu, Jun 21, 2012 at 2:44 PM, kshitiz <k.agarw...@gmail.com> wrote:
> Hi,
>
> I have a panel with ajax button (i.e. form) inside it. When I submit the
> form, not all of the components of that panel are being refreshed. Here is
> the code:
>
>
> public ShowCommentPanel(final String id,
>                        final List<CommentDomain> commentDomainList,
>                        final UserDomain userDomain) {
>                super(id);
>
> *               this.setOutputMarkupId(true);*
>
> *               // not getting refreshed
> *               Label numberOfCommentLabel = new Label("numberOfCommentLabel",
>                                "Number of comments "
>                                                + 
> Integer.toString(commentDomainList.size()));
>
> *                // getting refreshed*
>                final PageableListView<CommentDomain> commentDomainListView = 
> new
> PageableListView<CommentDomain>(
>                                "commentList", commentDomainList, 
> commentsPerPage) {
>
>                        @Override
>                        protected void populateItem(final 
> ListItem<CommentDomain> listItem) {
>
>                                Form<CommentDomain> showCommentForm = new 
> Form<CommentDomain>(
>                                                "showCommentForm",
>                                                new 
> CompoundPropertyModel<CommentDomain>(commentDomain));
>
>                                showCommentForm.setModelObject(commentDomain);
>
>                                final CommentDomain commentDomain = 
> ((CommentDomain) listItem
>                                                .getModelObject());
>                                String comment = ((CommentDomain) 
> listItem.getModelObject())
>                                                .getComment();
>                                Label commentLabel = new Label("commentLabel", 
> comment);
>
>                                AjaxFallbackButton ajaxCommentDeleteButton = 
> new AjaxFallbackButton(
>                                                "commentDeleteButton", 
> showCommentForm) {
>
>                                        private static final long 
> serialVersionUID = 1L;
>
>                                        @Override
>                                        public void onSubmit(AjaxRequestTarget 
> target,
>                                                        final Form<?> form) {
>
>                                                if (target != null) {
>                                                        CommentService 
> commentService = new CommentService();
>                                                        try {
>                                                                
> commentService.deleteComment(commentDomain);
>                                                                
> commentDomainList.remove(commentDomain);
>                                                        } catch (Exception 
> exception) {
>                                                                
> exception.printStackTrace();
>                                                                
> error(exception.getMessage());
>                                                        }
> *                                                       
> target.add(ShowCommentPanel.this);*
>                                                }
>                                        }
>
>                                };
>
>                                if (commentDomain.getUserDomain().getUserId() 
> != userDomain
>                                                .getUserId()) {
>                                        
> ajaxCommentDeleteButton.setVisible(false);
>                                }
>                                showCommentForm.add(commentLabel);
>                                showCommentForm.add(ajaxCommentDeleteButton);
>
>                                listItem.add(showCommentForm);
>                        }
>                };
>
>                commentDomainListView.setVisible(!commentDomainList.isEmpty());
>
> *                // not getting refreshed*
>                AjaxPagingNavigator ajaxPagingNavigator = new 
> AjaxPagingNavigator(
>                                "commentNavigator", commentDomainListView);
>                ajaxPagingNavigator.setVisible(!commentDomainList.isEmpty());
>
>        *       add(commentDomainListView); // getting refreshed
>                add(ajaxPagingNavigator); // not getting refreshed
>                add(numberOfCommentLabel); // not getting refreshed  *
>        }
>
>
> /What can be the problem??/
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Wicket-panel-not-getting-refreshed-completely-tp4650150.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
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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

Reply via email to