Re: Combining Ajax and non Ajax pages

2008-02-24 Thread steviezz

Think I've got it now. 

Added: 

countryDDC.clearInput();
countryDDC.setModelObject(null); 

regionDDC.clearInput();
regionDDC.setModelObject(null); 

target.addComponent(countryDDC);
target.addComponent(regionDDC); 


to the area DropDownChoice onchange: 

 areaDDC.add(new AjaxFormComponentUpdatingBehavior("onchange") {
protected void onUpdate(AjaxRequestTarget target) {

countryDDC.clearInput();
countryDDC.setModelObject(null); 

regionDDC.clearInput();
regionDDC.setModelObject(null); 

target.addComponent(countryDDC);
target.addComponent(regionDDC); 

   }
 });


Resets both country and region when the area changes.

I've learnt a lot from working through this use case.


Steve
-- 
View this message in context: 
http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15664149.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]



Re: Combining Ajax and non Ajax pages

2008-02-23 Thread steviezz

Now almost there.  I'm understanding the use of models much better now.  

I have created my own simple SeachModel class to holds Strings for each
selected dropdown choice.  In my custom session I wrap my model like:

CompoundPropertyModel searchModel = new CompoundPropertyModel(new
SearchModel());

Then in my search page I can now do: 

DropDownChoice countryDDC = new DropDownChoice("country", 
new PropertyModel(model, "country"), new Model() {
public Object getObject() {
SearchModel sm = (SearchModel) model.getObject();
String area = sm.getArea();
List countries = 
areaManager.getCountryLabel(area);
return countries;
}
})

and everthing gets stored to and from the session automatically.

I have overriden the default choice so my options always have the correct
null values, eg: 

  protected CharSequence getDefaultChoice(Object selected) {
   return "All countries";
  }

Only one problem still to solve - the one where if I select an area +
country + region combo - eg, N America - USA - Alabama, then change to a top
level area where the first country has no regions - eg, Africa - Alegeria -
the region dropdown sticks as the previously stored Alabama.  If I submit
the form, then the region dropdown gets reset OK - it's just not clearing
with the AJAX update to the country dropdown.  


Steve 







-- 
View this message in context: 
http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15661322.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]



Re: Combining Ajax and non Ajax pages

2008-02-22 Thread steviezz
   
// setModel(((WholSession) Session.get()).getAreaModel());

add(new SearchForm("searchForm"));
add(new FeedbackPanel("feedback"));
}

private class SearchForm extends Form {

public SearchForm(String id) {
super(id);

// set the area dropdown
final DropDownChoice areasDDC = new 
DropDownChoice("areas",
((WholSession) 
Session.get()).getAreaModel(),
((WholSession) 
Session.get()).getAreaList(),
new ChoiceRenderer("name", "id"));

areasDDC.setOutputMarkupId(true);
add(areasDDC);

// set the country dropdown
final DropDownChoice countriesDDC = new 
DropDownChoice("countries",
((WholSession) 
Session.get()).getCountryModel(),
((WholSession) 
Session.get()).getCountryList(),
new ChoiceRenderer("name", "id"));

countriesDDC.setOutputMarkupId(true);
add(countriesDDC);  

final DropDownChoice regionsDDC = new 
DropDownChoice("regions",
((WholSession) 
Session.get()).getRegionModel(),
((WholSession) 
Session.get()).getRegionList(),
new ChoiceRenderer("name", "id"));

regionsDDC.setOutputMarkupId(true);
add(regionsDDC);

areasDDC.add(new 
AjaxFormComponentUpdatingBehavior("onchange") {
 protected void onUpdate(AjaxRequestTarget target) {
// Reset the country dropdown when the area 
changes
Area area = ((AreaChoiceModel)
areasDDC.getModel()).getArea(); 
List lst = new 
ArrayList(area.getAreas());  
countriesDDC.setChoices(lst);   
((WholSession) 
Session.get()).setCountryList(lst);
countriesDDC.clearInput();
regionsDDC.clearInput();
target.addComponent(countriesDDC);
 }
});

countriesDDC.add(new 
AjaxFormComponentUpdatingBehavior("onchange") {
protected void onUpdate(AjaxRequestTarget target) {
   // Reset the region dropdown when the country
changes
   Area area = ((AreaChoiceModel)
countriesDDC.getModel()).getArea(); 
   List lst = new 
ArrayList(area.getAreas());   
   regionsDDC.setChoices(lst);  
   ((WholSession) 
Session.get()).setRegionList(lst);
   regionsDDC.clearInput(); 
   target.addComponent(regionsDDC);
}
   });
}

protected void onSubmit() {
AreaChoiceModel areaModel = (AreaChoiceModel) 
((WholSession) 
   Session.get()).getAreaModel();
AreaChoiceModel countryModel = (AreaChoiceModel) 
((WholSession) 
Session.get()).getCountryModel();
AreaChoiceModel regionModel = (AreaChoiceModel) 
((WholSession) 
 Session.get()).getRegionModel();

info("selected area : " + areaModel);
info("selected country : " + countryModel);
info("selected region : " + regionModel);

setResponsePage(new SearchResults());
};
}
}



-- 
View this message in context: 
http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15641991.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]



Re: Combining Ajax and non Ajax pages

2008-02-22 Thread steviezz

Thankyou guys.  I have this sample working now with a simple one area
dropdown.  

The challenge now is to get it all hanging together again with the multiple
related Ajax dropdowns.  

I'm still not exactly comfortable with the concept of the models. Wicket in
Action appears to have a good chapter on this, so plenty of reading for me
to do.  No doubt I'll be back with more questions at some point.  

Thanks again for the speedy help so far - this list appears to be generally
excellent. 

Steve 

 


igor.vaynberg wrote:
> 
> also
> 
> protected void onDetach() {
>areaModel = null;
>}
> 
> should be just areaModel.detach();
> 
> ondetach() is called every request on the session so you are actually
> nulling the model at the end of the request
> 
> -igor
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15640583.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]



Re: Combining Ajax and non Ajax pages

2008-02-22 Thread Igor Vaynberg
gt;  >  > Maurice
>  >  >>>  >  >
>  >  >>>  >  > On Thu, Feb 21, 2008 at 1:44 PM, steviezz
>  >  >>> <[EMAIL PROTECTED]>
>  >  >>>  >  > wrote:
>  >  >>>  >  >>
>  >  >>>  >  >>  Thanks.
>  >  >>>  >  >>
>  >  >>>  >  >>  I have already moved to using the session for storage.  I've
>  >  >>> tried just
>  >  >>>  >  >>  adding the complete search panel object to the session in the
>  >  >>> search
>  >  >>>  >  >>  onsubmit() and fetching it again to add to the results page -
>  >  >>> this works
>  >  >>>  >  >> and
>  >  >>>  >  >>  avoids some of my page reload and history issues (but adds a 
> few
>  >  >>>  >  >> others),
>  >  >>>  >  >>  but I presume its not really a good idea to store large object
>  >  >>> graphs in
>  >  >>>  >  >> the
>  >  >>>  >  >>  session - maybe better to just store the selected values and
>  >  >>> rebuild the
>  >  >>>  >  >>  selection dropdowns as required.  Plus, this will probably 
> help
>  >  >>> me iron
>  >  >>>  >  >> out
>  >  >>>  >  >>  my inconsistent dropdown state problems.
>  >  >>>  >  >>
>  >  >>>  >  >>  But I'm still searching for a magic solution that does not
>  >  >>> involve
>  >  >>>  >  >> writing
>  >  >>>  >  >>  too much code :-}
>  >  >>>  >  >>
>  >  >>>  >  >>
>  >  >>>  >  >>
>  >  >>>  >  >>
>  >  >>>  >  >>
>  >  >>>  >  >>  Mr Mean wrote:
>  >  >>>  >  >>  >
>  >  >>>  >  >>  > I would not recommend what you are doing here.
>  >  >>>  >  >>  > What happens is that wicket removes the panel from the
>  >  >>> original page
>  >  >>>  >  >>  > and attaches it to the new page, making it impossible to use
>  >  >>> the
>  >  >>>  >  >>  > backbutton (because wicket will complain about a missing
>  >  >>> component).
>  >  >>>  >  >>  > Also this only works if the html of the new page uses the 
> same
>  >  >>>  >  >>  > component id.
>  >  >>>  >  >>  >
>  >  >>>  >  >>  > It is better to store the selection for your dropdowns in 
> the
>  >  >>> session
>  >  >>>  >  >>  > (as suggested before).
>  >  >>>  >  >>  > Then in the constructor of your PanelSearch you can check if
>  >  >>> the
>  >  >>>  >  >>  > session contains a value for the dropdowns and if that is 
> the
>  >  >>> case set
>  >  >>>  >  >>  > it as the model for the dropdown. That way you don't have to
>  >  >>> pass the
>  >  >>>  >  >>  > state to every page.
>  >  >>>  >  >>  >
>  >  >>>  >  >>  > Maurice
>  >  >>>  >  >>  >
>  >  >>>  >  >>  > On Thu, Feb 21, 2008 at 11:35 AM, steviezz
>  >  >>> <[EMAIL PROTECTED]>
>  >  >>>  >  >>  > wrote:
>  >  >>>  >  >>  >>
>  >  >>>  >  >>  >>  Answering my own questions.
>  >  >>>  >  >>  >>
>  >  >>>  >  >>  >>  I can also pass the search panel to the results page from 
> my
>  >  >>> form
>  >  >>>  >  >>  >> onSubmit:
>  >  >>>  >  >>  >>
>  >  >>>  >  >>  >> setResponsePage(new
>  >  >>>  >  >>  >> SearchResults(((PanelSearch)this.getParent()),
>  >  >>>  >  >>  >>  search));
>  >  >>>  >  >>  >>
>  >  >>>  >  >>  >>  Then, in the results page:
>  >  >>>  >  >>  >>
>  >  >>&g

Re: Combining Ajax and non Ajax pages

2008-02-22 Thread Maurice Marrink
;>  too much code :-}
>  >>>  >  >>
>  >>>  >  >>
>  >>>  >  >>
>  >>>  >  >>
>  >>>  >  >>
>  >>>  >  >>  Mr Mean wrote:
>  >>>  >  >>  >
>  >>>  >  >>  > I would not recommend what you are doing here.
>  >>>  >  >>  > What happens is that wicket removes the panel from the
>  >>> original page
>  >>>  >  >>  > and attaches it to the new page, making it impossible to use
>  >>> the
>  >>>  >  >>  > backbutton (because wicket will complain about a missing
>  >>> component).
>  >>>  >  >>  > Also this only works if the html of the new page uses the same
>  >>>  >  >>  > component id.
>  >>>  >  >>  >
>  >>>  >  >>  > It is better to store the selection for your dropdowns in the
>  >>> session
>  >>>  >  >>  > (as suggested before).
>  >>>  >  >>  > Then in the constructor of your PanelSearch you can check if
>  >>> the
>  >>>  >  >>  > session contains a value for the dropdowns and if that is the
>  >>> case set
>  >>>  >  >>  > it as the model for the dropdown. That way you don't have to
>  >>> pass the
>  >>>  >  >>  > state to every page.
>  >>>  >  >>  >
>  >>>  >  >>  > Maurice
>  >>>  >  >>  >
>  >>>  >  >>  > On Thu, Feb 21, 2008 at 11:35 AM, steviezz
>  >>> <[EMAIL PROTECTED]>
>  >>>  >  >>  > wrote:
>  >>>  >  >>  >>
>  >>>  >  >>  >>  Answering my own questions.
>  >>>  >  >>  >>
>  >>>  >  >>  >>  I can also pass the search panel to the results page from my
>  >>> form
>  >>>  >  >>  >> onSubmit:
>  >>>  >  >>  >>
>  >>>  >  >>  >> setResponsePage(new
>  >>>  >  >>  >> SearchResults(((PanelSearch)this.getParent()),
>  >>>  >  >>  >>  search));
>  >>>  >  >>  >>
>  >>>  >  >>  >>  Then, in the results page:
>  >>>  >  >>  >>
>  >>>  >  >>  >>public SearchResults(PanelSearch searchPanel, Search
>  >>> search) {
>  >>>  >  >>  >>     add(searchPanel);
>  >>>  >  >>  >> }
>  >>>  >  >>  >>
>  >>>  >  >>  >>  Mostly seems to work OK - panel on results page retains
>  >>> state from
>  >>>  >  >>  >> search
>  >>>  >  >>  >>  page.
>  >>>  >  >>  >>
>  >>>  >  >>  >>  Still getting some weird behaviour with the Ajax dropdowns
>  >>> on page
>  >>>  >  >>  >> refreshes
>  >>>  >  >>  >>  - can get crazy state of North America, Canada, Kansas if I
>  >>> refresh
>  >>>  >  >> the
>  >>>  >  >>  >> page
>  >>>  >  >>  >>  between selection changes (old state gets mixed in with
>  >>> partial new
>  >>>  >  >>  >> state)
>  >>>  >  >>  >>
>  >>>  >  >>  >>  Other thing to sort is how to reload panel state if user
>  >>> goes back
>  >>>  >  >> to
>  >>>  >  >>  >> the
>  >>>  >  >>  >>  home page (containing search panel) via a basic external
>  >>> navigation
>  >>>  >  >> link
>  >>>  >  >>  >> -
>  >>>  >  >>  >>  panel will be in its initial blank state.  Perhaps I do need
>  >>> to look
>  >>>  >  >>  >> into
>  >>>  >  >>  >>  loading from the session for this.
>  >>>  >  >>  >>
>  >>>  >  >>  >>  But I'm starting to like Wicket - this kind of stuff takes
>  >>> much more
>  >>>  >  >>  >> code in
>  >>>  >  >>  >>  other frameworks.
>  >>>  >  >>  >>
>  >>>  >

Re: Combining Ajax and non Ajax pages

2008-02-22 Thread steviezz
>> onSubmit:
>>>  >  >>  >>
>>>  >  >>  >> setResponsePage(new
>>>  >  >>  >> SearchResults(((PanelSearch)this.getParent()),
>>>  >  >>  >>  search));
>>>  >  >>  >>
>>>  >  >>  >>  Then, in the results page:
>>>  >  >>  >>
>>>  >  >>  >>public SearchResults(PanelSearch searchPanel, Search
>>> search) {
>>>  >  >>  >> add(searchPanel);
>>>  >  >>  >> }
>>>  >  >>  >>
>>>  >  >>  >>  Mostly seems to work OK - panel on results page retains
>>> state from
>>>  >  >>  >> search
>>>  >  >>  >>  page.
>>>  >  >>  >>
>>>  >  >>  >>  Still getting some weird behaviour with the Ajax dropdowns
>>> on page
>>>  >  >>  >> refreshes
>>>  >  >>  >>  - can get crazy state of North America, Canada, Kansas if I
>>> refresh
>>>  >  >> the
>>>  >  >>  >> page
>>>  >  >>  >>  between selection changes (old state gets mixed in with
>>> partial new
>>>  >  >>  >> state)
>>>  >  >>  >>
>>>  >  >>  >>  Other thing to sort is how to reload panel state if user
>>> goes back
>>>  >  >> to
>>>  >  >>  >> the
>>>  >  >>  >>  home page (containing search panel) via a basic external
>>> navigation
>>>  >  >> link
>>>  >  >>  >> -
>>>  >  >>  >>  panel will be in its initial blank state.  Perhaps I do need
>>> to look
>>>  >  >>  >> into
>>>  >  >>  >>  loading from the session for this.
>>>  >  >>  >>
>>>  >  >>  >>  But I'm starting to like Wicket - this kind of stuff takes
>>> much more
>>>  >  >>  >> code in
>>>  >  >>  >>  other frameworks.
>>>  >  >>  >>
>>>  >  >>  >>
>>>  >  >>  >>
>>>  >  >>  >>
>>>  >  >>  >>  steviezz wrote:
>>>  >  >>  >>  >
>>>  >  >>  >>  > I am now passing the search form model to the new page in
>>> the
>>>  >  >>  >> constructor,
>>>  >  >>  >>  >
>>>  >  >>  >>  >   setResponsePage(new SearchResults(search));
>>>  >  >>  >>  >
>>>  >  >>  >>  > Works OK - I assume this is better than going through the
>>> session.
>>>  >  >>  >>  >
>>>  >  >>  >>  > But I have no idea (yet) how to reinitialise the search
>>> panel Ajax
>>>  >  >>  >>  > widgets.
>>>  >  >>  >>  >
>>>  >  >>  >>  >
>>>  >  >>  >>  >
>>>  >  >>  >>  >
>>>  >  >>  >>  > wicket user-2 wrote:
>>>  >  >>  >>  >>
>>>  >  >>  >>  >> store the backing model in the session and get it from
>>> the
>>>  >  >> session,
>>>  >  >>  >> this
>>>  >  >>  >>  >> will help you retain the state in all the cases
>>>  >  >>  >>  >>
>>>  >  >>  >>  >> Cheers
>>>  >  >>  >>  >> Dipu
>>>  >  >>  >>  >>
>>>  >  >>  >>  >>
>>>  >  >>  >>  >>
>>>  >  >>  >>  >
>>>  >  >>  >>  >
>>>  >  >>  >>
>>>  >  >>  >>  --
>>>  >  >>  >>  View this message in context:
>>>  >  >>  >>
>>>  >  >>
>>> http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15607263.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]
>>>  >  >>  >>
>>>  >  >>  >>
>>>  >  >>  >
>>>  >  >>  >
>>> -
>>>  >  >>  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>  >  >>  > For additional commands, e-mail: [EMAIL PROTECTED]
>>>  >  >>  >
>>>  >  >>  >
>>>  >  >>  >
>>>  >  >>
>>>  >  >>  --
>>>  >  >>  View this message in context:
>>>  >  >>
>>> http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15610292.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]
>>>  >  >>
>>>  >  >>
>>>  >  >
>>>  >  >
>>> -
>>>  >  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>  >  > For additional commands, e-mail: [EMAIL PROTECTED]
>>>  >  >
>>>  >  >
>>>  >  >
>>>  >
>>>  >  --
>>>  >  View this message in context:
>>> http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15618707.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]
>>>  >
>>>  >
>>>
>>> 
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>   
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15632887.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]



Re: Combining Ajax and non Ajax pages

2008-02-21 Thread Michael O'Cleirigh
 to the results page from my form
 >  >>  >> onSubmit:
 >  >>  >>
 >  >>  >> setResponsePage(new
 >  >>  >> SearchResults(((PanelSearch)this.getParent()),
 >  >>  >>  search));
 >  >>  >>
 >  >>  >>  Then, in the results page:
 >  >>  >>
 >  >>  >>public SearchResults(PanelSearch searchPanel, Search search) {
 >  >>  >> add(searchPanel);
 >  >>  >> }
 >  >>  >>
 >  >>  >>  Mostly seems to work OK - panel on results page retains state from
 >  >>  >> search
 >  >>  >>  page.
 >  >>  >>
 >  >>  >>  Still getting some weird behaviour with the Ajax dropdowns on page
 >  >>  >> refreshes
 >  >>  >>  - can get crazy state of North America, Canada, Kansas if I refresh
 >  >> the
 >  >>  >> page
 >  >>  >>  between selection changes (old state gets mixed in with partial new
 >  >>  >> state)
 >  >>  >>
 >  >>  >>  Other thing to sort is how to reload panel state if user goes back
 >  >> to
 >  >>  >> the
 >  >>  >>  home page (containing search panel) via a basic external navigation
 >  >> link
 >  >>  >> -
 >  >>  >>  panel will be in its initial blank state.  Perhaps I do need to look
 >  >>  >> into
 >  >>  >>  loading from the session for this.
 >  >>  >>
 >  >>  >>  But I'm starting to like Wicket - this kind of stuff takes much more
 >  >>  >> code in
 >  >>  >>  other frameworks.
 >  >>  >>
 >  >>  >>
 >  >>  >>
 >  >>  >>
 >  >>  >>  steviezz wrote:
 >  >>  >>  >
 >  >>  >>  > I am now passing the search form model to the new page in the
 >  >>  >> constructor,
 >  >>  >>  >
 >  >>  >>  >   setResponsePage(new SearchResults(search));
 >  >>  >>  >
 >  >>  >>  > Works OK - I assume this is better than going through the session.
 >  >>  >>  >
 >  >>  >>  > But I have no idea (yet) how to reinitialise the search panel Ajax
 >  >>  >>  > widgets.
 >  >>  >>  >
 >  >>  >>  >
 >  >>  >>  >
 >  >>  >>  >
 >  >>  >>  > wicket user-2 wrote:
 >  >>  >>  >>
 >  >>  >>  >> store the backing model in the session and get it from the
 >  >> session,
 >  >>  >> this
 >  >>  >>  >> will help you retain the state in all the cases
 >  >>  >>  >>
 >  >>  >>  >> Cheers
 >  >>  >>  >> Dipu
 >  >>  >>  >>
 >  >>  >>  >>
 >  >>  >>  >>
 >  >>  >>  >
 >  >>  >>  >
 >  >>  >>
 >  >>  >>  --
 >  >>  >>  View this message in context:
 >  >>  >>
 >  >> 
http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15607263.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]
 >  >>  >>
 >  >>  >>
 >  >>  >
 >  >>  > -
 >  >>  > To unsubscribe, e-mail: [EMAIL PROTECTED]
 >  >>  > For additional commands, e-mail: [EMAIL PROTECTED]
 >  >>  >
 >  >>  >
 >  >>  >
 >  >>
 >  >>  --
 >  >>  View this message in context:
 >  >> 
http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15610292.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]
 >  >>
 >  >>
 >  >
 >  > -
 >  > To unsubscribe, e-mail: [EMAIL PROTECTED]
 >  > For additional commands, e-mail: [EMAIL PROTECTED]
 >  >
 >  >
 >  >
 >
 >  --
 >  View this message in context: 
http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15618707.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]
 >
 >




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

  



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



Re: Combining Ajax and non Ajax pages

2008-02-21 Thread Maurice Marrink
hu, Feb 21, 2008 at 11:35 AM, steviezz <[EMAIL PROTECTED]>
>  >  >>  > wrote:
>  >  >>  >>
>  >  >>  >>  Answering my own questions.
>  >  >>  >>
>  >  >>  >>  I can also pass the search panel to the results page from my form
>  >  >>  >> onSubmit:
>  >  >>  >>
>  >  >>  >> setResponsePage(new
>  >  >>  >> SearchResults(((PanelSearch)this.getParent()),
>  >  >>  >>  search));
>  >  >>  >>
>  >  >>  >>  Then, in the results page:
>  >  >>  >>
>  >  >>  >>public SearchResults(PanelSearch searchPanel, Search 
> search) {
>  >  >>  >> add(searchPanel);
>  >  >>  >> }
>  >  >>  >>
>  >  >>  >>  Mostly seems to work OK - panel on results page retains state from
>  >  >>  >> search
>  >  >>  >>  page.
>  >  >>  >>
>  >  >>  >>  Still getting some weird behaviour with the Ajax dropdowns on page
>  >  >>  >> refreshes
>  >  >>  >>  - can get crazy state of North America, Canada, Kansas if I 
> refresh
>  >  >> the
>  >  >>  >> page
>  >  >>  >>  between selection changes (old state gets mixed in with partial 
> new
>  >  >>  >> state)
>  >  >>  >>
>  >  >>  >>  Other thing to sort is how to reload panel state if user goes back
>  >  >> to
>  >  >>  >> the
>  >  >>  >>  home page (containing search panel) via a basic external 
> navigation
>  >  >> link
>  >  >>  >> -
>  >  >>  >>  panel will be in its initial blank state.  Perhaps I do need to 
> look
>  >  >>  >> into
>  >  >>  >>  loading from the session for this.
>  >  >>  >>
>  >  >>  >>  But I'm starting to like Wicket - this kind of stuff takes much 
> more
>  >  >>  >> code in
>  >  >>  >>  other frameworks.
>  >  >>  >>
>  >  >>  >>
>  >  >>  >>
>  >  >>  >>
>  >  >>  >>  steviezz wrote:
>  >  >>  >>  >
>  >  >>  >>  > I am now passing the search form model to the new page in the
>  >  >>  >> constructor,
>  >  >>  >>  >
>  >  >>  >>  >   setResponsePage(new SearchResults(search));
>  >  >>  >>  >
>  >  >>  >>  > Works OK - I assume this is better than going through the 
> session.
>  >  >>  >>  >
>  >  >>  >>  > But I have no idea (yet) how to reinitialise the search panel 
> Ajax
>  >  >>  >>  > widgets.
>  >  >>  >>  >
>  >  >>  >>  >
>  >  >>  >>  >
>  >  >>  >>  >
>  >  >>  >>  > wicket user-2 wrote:
>  >  >>  >>  >>
>  >  >>  >>  >> store the backing model in the session and get it from the
>  >  >> session,
>  >  >>  >> this
>  >  >>  >>  >> will help you retain the state in all the cases
>  >  >>  >>  >>
>  >  >>  >>  >> Cheers
>  >  >>  >>  >> Dipu
>  >  >>  >>  >>
>  >  >>  >>  >>
>  >  >>  >>  >>
>  >  >>  >>  >
>  >  >>  >>  >
>  >  >>  >>
>  >  >>  >>  --
>  >  >>  >>  View this message in context:
>  >  >>  >>
>  >  >> 
> http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15607263.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]
>  >  >>  >>
>  >  >>  >>
>  >  >>  >
>  >  >>  > 
> -
>  >  >>  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>  >  >>  > For additional commands, e-mail: [EMAIL PROTECTED]
>  >  >>  >
>  >  >>  >
>  >  >>  >
>  >  >>
>  >  >>  --
>  >  >>  View this message in context:
>  >  >> 
> http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15610292.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]
>  >  >>
>  >  >>
>  >  >
>  >  > -
>  >  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>  >  > For additional commands, e-mail: [EMAIL PROTECTED]
>  >  >
>  >  >
>  >  >
>  >
>  >  --
>  >  View this message in context: 
> http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15618707.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]
>  >
>  >
>

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



Re: Combining Ajax and non Ajax pages

2008-02-21 Thread Maurice Marrink
>>  Mostly seems to work OK - panel on results page retains state from
>  >>  >> search
>  >>  >>  page.
>  >>  >>
>  >>  >>  Still getting some weird behaviour with the Ajax dropdowns on page
>  >>  >> refreshes
>  >>  >>  - can get crazy state of North America, Canada, Kansas if I refresh
>  >> the
>  >>  >> page
>  >>  >>  between selection changes (old state gets mixed in with partial new
>  >>  >> state)
>  >>  >>
>  >>  >>  Other thing to sort is how to reload panel state if user goes back
>  >> to
>  >>  >> the
>  >>  >>  home page (containing search panel) via a basic external navigation
>  >> link
>  >>  >> -
>  >>  >>  panel will be in its initial blank state.  Perhaps I do need to look
>  >>  >> into
>  >>  >>  loading from the session for this.
>  >>  >>
>  >>  >>  But I'm starting to like Wicket - this kind of stuff takes much more
>  >>  >> code in
>  >>  >>  other frameworks.
>  >>  >>
>  >>  >>
>  >>  >>
>  >>  >>
>  >>  >>  steviezz wrote:
>  >>  >>  >
>  >>  >>  > I am now passing the search form model to the new page in the
>  >>  >> constructor,
>  >>  >>  >
>  >>  >>  >   setResponsePage(new SearchResults(search));
>  >>  >>  >
>  >>  >>  > Works OK - I assume this is better than going through the session.
>  >>  >>  >
>  >>  >>  > But I have no idea (yet) how to reinitialise the search panel Ajax
>  >>  >>  > widgets.
>  >>  >>  >
>  >>  >>  >
>  >>  >>  >
>  >>  >>  >
>  >>  >>  > wicket user-2 wrote:
>  >>  >>  >>
>  >>  >>  >> store the backing model in the session and get it from the
>  >> session,
>  >>  >> this
>  >>  >>  >> will help you retain the state in all the cases
>  >>  >>  >>
>  >>  >>  >> Cheers
>  >>  >>  >> Dipu
>  >>  >>  >>
>  >>  >>  >>
>  >>  >>  >>
>  >>  >>  >
>  >>  >>  >
>  >>  >>
>  >>  >>  --
>  >>  >>  View this message in context:
>  >>  >>
>  >> 
> http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15607263.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]
>  >>  >>
>  >>  >>
>  >>  >
>  >>  > -
>  >>  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>  >>  > For additional commands, e-mail: [EMAIL PROTECTED]
>  >>  >
>  >>  >
>  >>  >
>  >>
>  >>  --
>  >>  View this message in context:
>  >> 
> http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15610292.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]
>  >>
>  >>
>  >
>  > -
>  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>  > For additional commands, e-mail: [EMAIL PROTECTED]
>  >
>  >
>  >
>
>  --
>  View this message in context: 
> http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15618707.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]
>
>

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



Re: Combining Ajax and non Ajax pages

2008-02-21 Thread steviezz
is.
>>  >>
>>  >>  But I'm starting to like Wicket - this kind of stuff takes much more
>>  >> code in
>>  >>  other frameworks.
>>  >>
>>  >>
>>  >>
>>  >>
>>  >>  steviezz wrote:
>>  >>  >
>>  >>  > I am now passing the search form model to the new page in the
>>  >> constructor,
>>  >>  >
>>  >>  >   setResponsePage(new SearchResults(search));
>>  >>  >
>>  >>  > Works OK - I assume this is better than going through the session.
>>  >>  >
>>  >>  > But I have no idea (yet) how to reinitialise the search panel Ajax
>>  >>  > widgets.
>>  >>  >
>>  >>  >
>>  >>  >
>>  >>  >
>>  >>  > wicket user-2 wrote:
>>  >>  >>
>>  >>  >> store the backing model in the session and get it from the
>> session,
>>  >> this
>>  >>  >> will help you retain the state in all the cases
>>  >>  >>
>>  >>  >> Cheers
>>  >>  >> Dipu
>>  >>  >>
>>  >>  >>
>>  >>  >>
>>  >>  >
>>  >>  >
>>  >>
>>  >>  --
>>  >>  View this message in context:
>>  >>
>> http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15607263.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]
>>  >>
>>  >>
>>  >
>>  > -
>>  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>>  > For additional commands, e-mail: [EMAIL PROTECTED]
>>  >
>>  >
>>  >
>>
>>  --
>>  View this message in context:
>> http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15610292.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]
>>
>>
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15618707.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]



Re: Combining Ajax and non Ajax pages

2008-02-21 Thread steviezz

Ahah - I think I'm starting to see the light...

Thanks for the hints.



Mr Mean wrote:
> 
> Don't add wicket components to the session, use models.
> for example
> class MySession extends WebSession
> {
>  private IModel dropdown1=new WhateverModel(null); //etc for the others
>  // add getters() for models
> }
> 
> class PanelSearch extends Panel
> {
>  public PanelSearch(String id)
> {
>  super(id);
>  add(new
> DropDownChoice("dropdown1",((MySession)Session.get()).getDropdown1(),myChoices)
> }
> }
> 
> class SomePage extends WebPage
> {
>  public SomePage()
> {
>  super();
>  add(new PanelSearch("search"));
> }
> }
> 
> The trick is always using the shared models in your session, that is
> why you don't need setters for them and you have to initialize them
> properly with some default.
> That way the form automatically writes the new values to your session
> and you don't have to do that manually.
> 
> How much less code can you have?
> 
> Maurice
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15611982.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]



Re: Combining Ajax and non Ajax pages

2008-02-21 Thread Maurice Marrink
Don't add wicket components to the session, use models.
for example
class MySession extends WebSession
{
 private IModel dropdown1=new WhateverModel(null); //etc for the others
 // add getters() for models
}

class PanelSearch extends Panel
{
 public PanelSearch(String id)
{
 super(id);
 add(new 
DropDownChoice("dropdown1",((MySession)Session.get()).getDropdown1(),myChoices)
}
}

class SomePage extends WebPage
{
 public SomePage()
{
 super();
 add(new PanelSearch("search"));
}
}

The trick is always using the shared models in your session, that is
why you don't need setters for them and you have to initialize them
properly with some default.
That way the form automatically writes the new values to your session
and you don't have to do that manually.

How much less code can you have?

Maurice

On Thu, Feb 21, 2008 at 1:44 PM, steviezz <[EMAIL PROTECTED]> wrote:
>
>  Thanks.
>
>  I have already moved to using the session for storage.  I've tried just
>  adding the complete search panel object to the session in the search
>  onsubmit() and fetching it again to add to the results page - this works and
>  avoids some of my page reload and history issues (but adds a few others),
>  but I presume its not really a good idea to store large object graphs in the
>  session - maybe better to just store the selected values and rebuild the
>  selection dropdowns as required.  Plus, this will probably help me iron out
>  my inconsistent dropdown state problems.
>
>  But I'm still searching for a magic solution that does not involve writing
>  too much code :-}
>
>
>
>
>
>  Mr Mean wrote:
>  >
>  > I would not recommend what you are doing here.
>  > What happens is that wicket removes the panel from the original page
>  > and attaches it to the new page, making it impossible to use the
>  > backbutton (because wicket will complain about a missing component).
>  > Also this only works if the html of the new page uses the same
>  > component id.
>  >
>  > It is better to store the selection for your dropdowns in the session
>  > (as suggested before).
>  > Then in the constructor of your PanelSearch you can check if the
>  > session contains a value for the dropdowns and if that is the case set
>  > it as the model for the dropdown. That way you don't have to pass the
>  > state to every page.
>  >
>  > Maurice
>  >
>  > On Thu, Feb 21, 2008 at 11:35 AM, steviezz <[EMAIL PROTECTED]>
>  > wrote:
>  >>
>  >>  Answering my own questions.
>  >>
>  >>  I can also pass the search panel to the results page from my form
>  >> onSubmit:
>  >>
>  >> setResponsePage(new
>  >> SearchResults(((PanelSearch)this.getParent()),
>  >>  search));
>  >>
>  >>  Then, in the results page:
>  >>
>  >>public SearchResults(PanelSearch searchPanel, Search search) {
>  >> add(searchPanel);
>  >> }
>  >>
>  >>  Mostly seems to work OK - panel on results page retains state from
>  >> search
>  >>  page.
>  >>
>  >>  Still getting some weird behaviour with the Ajax dropdowns on page
>  >> refreshes
>  >>  - can get crazy state of North America, Canada, Kansas if I refresh the
>  >> page
>  >>  between selection changes (old state gets mixed in with partial new
>  >> state)
>  >>
>  >>  Other thing to sort is how to reload panel state if user goes back to
>  >> the
>  >>  home page (containing search panel) via a basic external navigation link
>  >> -
>  >>  panel will be in its initial blank state.  Perhaps I do need to look
>  >> into
>  >>  loading from the session for this.
>  >>
>  >>  But I'm starting to like Wicket - this kind of stuff takes much more
>  >> code in
>  >>  other frameworks.
>  >>
>  >>
>  >>
>  >>
>  >>  steviezz wrote:
>  >>  >
>  >>  > I am now passing the search form model to the new page in the
>  >> constructor,
>  >>  >
>  >>  >   setResponsePage(new SearchResults(search));
>  >>  >
>  >>  > Works OK - I assume this is better than going through the session.
>  >>  >
>  >>  > But I have no idea (yet) how to reinitialise the search panel Ajax
>  >>  > widgets.
>  >>  >
>  >>  >
>  >>  >
>  >>  >
>  >>  > wicket user-2 wrote:
>  >>  >>
>  >>  >> store 

Re: Combining Ajax and non Ajax pages

2008-02-21 Thread steviezz

Thanks. 

I have already moved to using the session for storage.  I've tried just
adding the complete search panel object to the session in the search
onsubmit() and fetching it again to add to the results page - this works and
avoids some of my page reload and history issues (but adds a few others),
but I presume its not really a good idea to store large object graphs in the
session - maybe better to just store the selected values and rebuild the
selection dropdowns as required.  Plus, this will probably help me iron out
my inconsistent dropdown state problems.  

But I'm still searching for a magic solution that does not involve writing
too much code :-} 



Mr Mean wrote:
> 
> I would not recommend what you are doing here.
> What happens is that wicket removes the panel from the original page
> and attaches it to the new page, making it impossible to use the
> backbutton (because wicket will complain about a missing component).
> Also this only works if the html of the new page uses the same
> component id.
> 
> It is better to store the selection for your dropdowns in the session
> (as suggested before).
> Then in the constructor of your PanelSearch you can check if the
> session contains a value for the dropdowns and if that is the case set
> it as the model for the dropdown. That way you don't have to pass the
> state to every page.
> 
> Maurice
> 
> On Thu, Feb 21, 2008 at 11:35 AM, steviezz <[EMAIL PROTECTED]>
> wrote:
>>
>>  Answering my own questions.
>>
>>  I can also pass the search panel to the results page from my form
>> onSubmit:
>>
>> setResponsePage(new
>> SearchResults(((PanelSearch)this.getParent()),
>>  search));
>>
>>  Then, in the results page:
>>
>>public SearchResults(PanelSearch searchPanel, Search search) {
>> add(searchPanel);
>> }
>>
>>  Mostly seems to work OK - panel on results page retains state from
>> search
>>  page.
>>
>>  Still getting some weird behaviour with the Ajax dropdowns on page
>> refreshes
>>  - can get crazy state of North America, Canada, Kansas if I refresh the
>> page
>>  between selection changes (old state gets mixed in with partial new
>> state)
>>
>>  Other thing to sort is how to reload panel state if user goes back to
>> the
>>  home page (containing search panel) via a basic external navigation link
>> -
>>  panel will be in its initial blank state.  Perhaps I do need to look
>> into
>>  loading from the session for this.
>>
>>  But I'm starting to like Wicket - this kind of stuff takes much more
>> code in
>>  other frameworks.
>>
>>
>>
>>
>>  steviezz wrote:
>>  >
>>  > I am now passing the search form model to the new page in the
>> constructor,
>>  >
>>  >   setResponsePage(new SearchResults(search));
>>  >
>>  > Works OK - I assume this is better than going through the session.
>>  >
>>  > But I have no idea (yet) how to reinitialise the search panel Ajax
>>  > widgets.
>>  >
>>  >
>>  >
>>  >
>>  > wicket user-2 wrote:
>>  >>
>>  >> store the backing model in the session and get it from the session,
>> this
>>  >> will help you retain the state in all the cases
>>  >>
>>  >> Cheers
>>  >> Dipu
>>  >>
>>  >>
>>  >>
>>  >
>>  >
>>
>>  --
>>  View this message in context:
>> http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15607263.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]
>>
>>
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15610292.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]



Re: Combining Ajax and non Ajax pages

2008-02-21 Thread Maurice Marrink
I would not recommend what you are doing here.
What happens is that wicket removes the panel from the original page
and attaches it to the new page, making it impossible to use the
backbutton (because wicket will complain about a missing component).
Also this only works if the html of the new page uses the same
component id.

It is better to store the selection for your dropdowns in the session
(as suggested before).
Then in the constructor of your PanelSearch you can check if the
session contains a value for the dropdowns and if that is the case set
it as the model for the dropdown. That way you don't have to pass the
state to every page.

Maurice

On Thu, Feb 21, 2008 at 11:35 AM, steviezz <[EMAIL PROTECTED]> wrote:
>
>  Answering my own questions.
>
>  I can also pass the search panel to the results page from my form onSubmit:
>
> setResponsePage(new SearchResults(((PanelSearch)this.getParent()),
>  search));
>
>  Then, in the results page:
>
>public SearchResults(PanelSearch searchPanel, Search search) {
> add(searchPanel);
> }
>
>  Mostly seems to work OK - panel on results page retains state from search
>  page.
>
>  Still getting some weird behaviour with the Ajax dropdowns on page refreshes
>  - can get crazy state of North America, Canada, Kansas if I refresh the page
>  between selection changes (old state gets mixed in with partial new state)
>
>  Other thing to sort is how to reload panel state if user goes back to the
>  home page (containing search panel) via a basic external navigation link -
>  panel will be in its initial blank state.  Perhaps I do need to look into
>  loading from the session for this.
>
>  But I'm starting to like Wicket - this kind of stuff takes much more code in
>  other frameworks.
>
>
>
>
>  steviezz wrote:
>  >
>  > I am now passing the search form model to the new page in the constructor,
>  >
>  >   setResponsePage(new SearchResults(search));
>  >
>  > Works OK - I assume this is better than going through the session.
>  >
>  > But I have no idea (yet) how to reinitialise the search panel Ajax
>  > widgets.
>  >
>  >
>  >
>  >
>  > wicket user-2 wrote:
>  >>
>  >> store the backing model in the session and get it from the session, this
>  >> will help you retain the state in all the cases
>  >>
>  >> Cheers
>  >> Dipu
>  >>
>  >>
>  >>
>  >
>  >
>
>  --
>  View this message in context: 
> http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15607263.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]
>
>

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



Re: Combining Ajax and non Ajax pages

2008-02-21 Thread steviezz

Answering my own questions.

I can also pass the search panel to the results page from my form onSubmit: 

setResponsePage(new SearchResults(((PanelSearch)this.getParent()),
search));

Then, in the results page: 

   public SearchResults(PanelSearch searchPanel, Search search) {
add(searchPanel);
}

Mostly seems to work OK - panel on results page retains state from search
page.

Still getting some weird behaviour with the Ajax dropdowns on page refreshes
- can get crazy state of North America, Canada, Kansas if I refresh the page
between selection changes (old state gets mixed in with partial new state)

Other thing to sort is how to reload panel state if user goes back to the
home page (containing search panel) via a basic external navigation link -
panel will be in its initial blank state.  Perhaps I do need to look into
loading from the session for this.  

But I'm starting to like Wicket - this kind of stuff takes much more code in
other frameworks.  



steviezz wrote:
> 
> I am now passing the search form model to the new page in the constructor, 
> 
>   setResponsePage(new SearchResults(search));
> 
> Works OK - I assume this is better than going through the session. 
> 
> But I have no idea (yet) how to reinitialise the search panel Ajax
> widgets. 
> 
> 
> 
> 
> wicket user-2 wrote:
>> 
>> store the backing model in the session and get it from the session, this
>> will help you retain the state in all the cases
>> 
>> Cheers
>> Dipu
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15607263.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]



Re: Combining Ajax and non Ajax pages

2008-02-21 Thread steviezz

I am now passing the search form model to the new page in the constructor, 

  setResponsePage(new SearchResults(search));

Works OK - I assume this is better than going through the session. 

But I have no idea (yet) how to reinitialise the search panel Ajax widgets. 




wicket user-2 wrote:
> 
> store the backing model in the session and get it from the session, this
> will help you retain the state in all the cases
> 
> Cheers
> Dipu
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15607248.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]



Re: Combining Ajax and non Ajax pages

2008-02-20 Thread wicket user
store the backing model in the session and get it from the session, this
will help you retain the state in all the cases

Cheers
Dipu

On Feb 20, 2008 11:38 AM, steviezz <[EMAIL PROTECTED]> wrote:

>
> I have a panel on my application home page containing 3 related dropdowns
> -
> area/country/region.
>
> I use AjaxFormComponentUpdatingBehavior to populate the lower dropdowns
> when
> a higher one changes - eg:
>
>  area changes - country and region dropdowns get reset
>  country changes - region dropdown gets reset
>
> Code looks like:
>
> private DropDownChoice getCountriesDDC(IModel countryChoices,
>final DropDownChoice regions) {
>
>logger.debug("Enter getCountriesDDC");
>
>final DropDownChoice countries = new
> DropDownChoice("countries",
>new PropertyModel(this, "selectedCountry"),
> countryChoices,
>new ChoiceRenderer("name", "id"));
>
>countries.add(new
> AjaxFormComponentUpdatingBehavior("onchange") {
>protected void onUpdate(AjaxRequestTarget target) {
>regions.clearInput();
>regions.setModelObject(null);
>target.addComponent(regions);
>}
>});
>
>countries.setOutputMarkupId(true);
>
>logger.debug("Exit getCountriesDDC " + countries);
>
>return countries;
>}
>
>
> My application is not a full-blown Ajax app - it still needs to be search
> engine and user friendly.  So, when I submit my form having selected the
> various dropdowns, I want to forward to a traditional results pages rather
> than pull the results into the original page with Ajax.
>
> But I also want to include the search panel at the top of the results page
> and maintain its dropdown state from the original search page (so the
> selection matches the displayed results).  For example, user selects
> "North
> America / United States / California" on the search page, then the results
> page should have all 3 dropdowns popluated with all the North American
> choices in dropdown 2, and the USA states in dropdown 3 - with USA and
> California selected.
>
> I also need to maintain the same search panel dropdown state if the user
> uses the main site navigation links to go back to the home page - this
> will
> be from a simple url like /app/home.
>
> Search dropdown state must also survive a page refresh.  I hate it when
> applications (typical flight booking systems, etc) make you re-enter all
> the
> search criteria if you go back to the home page, deviate out of their
> restricted page-flow, or refresh the page.  At present, on page refresh,
> my
> the top level area dropdown retains its choices but the country and region
> dropdowns have their choices removed (no way to get them back unless you
> select a different top level area to re-fire the Ajax Javascript).
>
> In summary, I need to know:
>
> 1.  how to make the dropdown state survive when I include the search panel
> on another page
>
> 2.  how to make the dropdown state survive when I navigate back to the
> original page using a simple home page navigation link (effectively
> reloading the home page)
>
> 3.  how to make the dropdown state survive a page refresh (much the same
> same as 2).
>
>
> Of course, if I am wasting my time because this is stupid, then I'd value
> any other suggestions on how to deal with this by redesigning the user
> interface.
>
> Thanks.
>
>
> --
> View this message in context:
> http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15587166.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]
>
>


Combining Ajax and non Ajax pages

2008-02-20 Thread steviezz

I have a panel on my application home page containing 3 related dropdowns -
area/country/region.  

I use AjaxFormComponentUpdatingBehavior to populate the lower dropdowns when
a higher one changes - eg:

  area changes - country and region dropdowns get reset 
  country changes - region dropdown gets reset 

Code looks like: 

 private DropDownChoice getCountriesDDC(IModel countryChoices,
final DropDownChoice regions) {

logger.debug("Enter getCountriesDDC");

final DropDownChoice countries = new DropDownChoice("countries",
new PropertyModel(this, "selectedCountry"), 
countryChoices,
new ChoiceRenderer("name", "id"));

countries.add(new AjaxFormComponentUpdatingBehavior("onchange") 
{
protected void onUpdate(AjaxRequestTarget target) {
regions.clearInput();
regions.setModelObject(null); 
target.addComponent(regions);
}
});

countries.setOutputMarkupId(true);

logger.debug("Exit getCountriesDDC " + countries);

return countries;
}


My application is not a full-blown Ajax app - it still needs to be search
engine and user friendly.  So, when I submit my form having selected the
various dropdowns, I want to forward to a traditional results pages rather
than pull the results into the original page with Ajax.   

But I also want to include the search panel at the top of the results page
and maintain its dropdown state from the original search page (so the
selection matches the displayed results).  For example, user selects "North
America / United States / California" on the search page, then the results
page should have all 3 dropdowns popluated with all the North American
choices in dropdown 2, and the USA states in dropdown 3 - with USA and
California selected.

I also need to maintain the same search panel dropdown state if the user
uses the main site navigation links to go back to the home page - this will
be from a simple url like /app/home.  

Search dropdown state must also survive a page refresh.  I hate it when
applications (typical flight booking systems, etc) make you re-enter all the
search criteria if you go back to the home page, deviate out of their
restricted page-flow, or refresh the page.  At present, on page refresh, my
the top level area dropdown retains its choices but the country and region
dropdowns have their choices removed (no way to get them back unless you
select a different top level area to re-fire the Ajax Javascript).

In summary, I need to know: 

1.  how to make the dropdown state survive when I include the search panel
on another page

2.  how to make the dropdown state survive when I navigate back to the
original page using a simple home page navigation link (effectively
reloading the home page)   

3.  how to make the dropdown state survive a page refresh (much the same
same as 2).  


Of course, if I am wasting my time because this is stupid, then I'd value
any other suggestions on how to deal with this by redesigning the user
interface.

Thanks. 


-- 
View this message in context: 
http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15587166.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]