Hi,

I see some problem/inconsistencies in your code.

1/
Model.of(searchDomain.getSearch()) is not accurate. You better have to use
'new PropertyModel<String>(searchDomain, "search")'.
You already defined the getSearch() method, be sure to also have
setSearch(String text) method for the property model to work as expected
(so it can set the value!).
This is the most important point I think.

2/
In the same way, it is not needed - in your case - to have a LDM in your
SearchResultPanel/Label. I would have changed the panel by:
public SearchResultPanel(String id, final Model<SearchDomain> model) {
               super(id);

               add(new Label("temp", new
PropertyModel<String>(model.getObject(), "search"))
}

3/
As I changed the Panel constructor above, we need to change to call. But, I
will prefer to pass the form's model. Thus, a CompoundPropertyModel is not
(yet?) needed. So:

Form<SearchDomain> searchForm = new Form<SearchDomain>("searchForm", new
Model<SearchDomain>(searchDomain));
final SearchResultPanel searchResultPanel = new
SearchResultPanel("searchResultPanel", form.getModel());

4/
searchResultPanel.setOutputMarkupId(true);
searchResultPanel.setOutputMarkupPlaceholderTag(true);

setOutputMarkupPlaceholderTag already sets the outputMarkupId to true. So,
use the one or the other. setOutputMarkupPlaceholderTag is needed if the
panel start in a not visible state. It will create an anchor for the ajax
call to be able to attach the visible component.

5/
searchForm.setModelObject(searchDomain);

Also not needed, you already sets the model object at the form's creation.


That's about all I see. Hope this helps.
Sebastien.


On Mon, Jun 11, 2012 at 8:29 PM, kshitiz <[email protected]> wrote:

> Please help me ....I am really not able to understand why it is
> happening....The form is really simple now:
>
>
> public Search(final PageParameters pageParameters) {
>
>                super(pageParameters);
>
>                Form<SearchDomain> searchForm = new
> Form<SearchDomain>("searchForm",
>                                new
> CompoundPropertyModel<SearchDomain>(searchDomain));
>
> *               final SearchResultPanel searchResultPanel = new
> SearchResultPanel(
>                                 "searchResultPanel", searchDomain);
>                 searchResultPanel.setOutputMarkupId(true);
>                searchResultPanel.setOutputMarkupPlaceholderTag(true);
> *
>                searchForm.setModelObject(searchDomain);
>
>                // defining text field for user to search
>                final RequiredTextField<String> searchTextField = new
> RequiredTextField<String>(
>                                "search",
> Model.of(searchDomain.getSearch()));
>
>                AjaxFallbackButton ajaxSearchButton = new
> AjaxFallbackButton(
>                                "searchButton", searchForm) {
>
>                        @Override
>                        public void onSubmit(AjaxRequestTarget target,
> final Form<?> form) {
>                                if (target != null) {
>
>                                        try {
>                                 *
> target.add(searchResultPanel);*
>
>                                        } catch (Exception exception) {
>
>  error(exception.getMessage());
>                                        }
>
>
>                                }
>                        }
>
>                };
>
> *               searchForm.add(searchTextField);
>                searchForm.add(searchResultPanel);
>                searchForm.add(ajaxSearchButton);
>                add(searchForm);
> *       }
>
> And SearchResultPanel is:
>
>
> *public SearchResultPanel(String id, final SearchDomain searchDomain) {
>                super(id);
>                Label label = new Label("temp", new
>                                LoadableDetachableModel() { @Override
>                                protected Object load() { return
>                                searchDomain.getSearch(); }});
>                add(label);
> }
> *
>
> /But still, resultPanel is not displaying search text after being
> refreshed..that is the panel is not getting refreshed...!!! In every
> example
> I have seen in forums, it is done in the same manner...then why it is not
> happening..!!!!!!!  I am using wicket 1.5...
> /
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Panel-not-getting-refreshed-tp4649807p4649857.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to