Hi Guys,

I need help regarding a simple use case.
I have a BasePage that has Two Panels : Top Panel and Bottom Panel

User Can enter search criteria in top Panel and Results need to be displayed
in Bottom Panel. Results displayed in ListView/DataView 

#html looks like this...
<div wicket:id="topPanel">[Top panel]</div>
<div wicket:id="BottomPanel">[Bottom panel]</div>

#TopPanel
<form wicket:id="searchForm" >
    // Lots of Search Fields....
    // Submit Button
</form>

#BottomPanel
<divwicket:id="table">[ListView]</div>

How do I pass the search Criteria(a POJO) of Top Panel when user Submits the
Form to Bottom Panel?
Or,
If I use a webmarkup container for the search results....and use only one
panel(i.e the top panel) for search AND display...then how do i update the
Model for ListView? I tried all possible combinations...but failed...am I
missing something.
I was trying the use case that When user loads up the form first time the
fields of Search form are empty so ListView/dataview has no results.
When user enters some search criteria and clicks "Search" the web markup
container below updates its Model and displays the results according to
updated model....if there are no results then nothing gets displayed.

                final WebMarkupContainer contactsWrapper = new 
WebMarkupContainer(
                                "contactsWrap");

                form.add(new AjaxButton("searchContacts") {
                        
                        protected void onSubmit(AjaxRequestTarget target, Form 
f) {
                                final ContactInfoPOJO c = (ContactInfoPOJO) 
getForm().getModelObject();

                                IModel newModel = new LoadableDetachableModel() 
{
                                        protected Object load() {
                                                return
WicketApplication.get().getContactInfoDao().getContactsBySearch(c);
                                        }
                                };

                                // If javascript is enabled on user's browser.
                                if (target != null) {
                                        // refresh the component.
                                        target.addComponent(contactsWrapper);
                                }
                        }
                }); 

Here the problem is that Model cannot be updated??

        final ListView contacts = new ListView("viewContacts", 
contactInfoModel) {
        protected void populateItem(final ListItem item) {
                                item.add(new Label("fName", new 
PropertyModel(item.getModel(),
                                                "firstName")));
                                item.add(new Label("lName", new 
PropertyModel(item.getModel(),
                                                "lastName")));

}
}

contactsWrapper.add(contacts);




I have also attached the sample source files. Please help me .

Thanks

http://www.nabble.com/file/p18413133/SaveAndDisplayAjax.html
SaveAndDisplayAjax.html 
http://www.nabble.com/file/p18413133/SaveAndDisplayAjax.java
SaveAndDisplayAjax.java 
-- 
View this message in context: 
http://www.nabble.com/Search-and-Display-Results-on-same-page-Ajax-or-No-Ajax--tp18413133p18413133.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to