wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kshitiz <k.agarw...@gmail.com>
Subject Wicket panel not getting refreshed completely
Date Thu, 21 Jun 2012 11:44:25 GMT
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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Mime
View raw message