Short version of my question:
Why wouldn't redrawing a surrounding span for an AjaxCheckBox (all
embedded inside a ListView) be enough to get it to check its
underlying PropertyModel, and then reflect that new value?
(and is it broken for an underlying PropertyModel's hashmap to return
null for that key?)
Background:
So I'm tearing my hair out over this, because I've (somewhat) deeply
researched what's going on our code side, but might be dumbly missing
something basic on the Wicket side.
We have a list view that iterates over manufacturers, and each
manufacturer has a "pallet control" of devices
(two list boxes w/ move selection to right list, move selection to
left list buttons between) along with a "all for manufacturer"
checkbox
(the checkbox is a bit tricky, because it's also saying "this is true
for this manufacturer even if it's not a device we recognize")
When you click the select all checkbox, it calls the function that
moves everything into the right hand select list, great.
What I'd like to have happen is moving an item from the right hand
list back to the left also unchecks the select box.
I cannot get this checkbox to update for anything!
Another developer has the underlying model contain a
HashMap<String,Boolean> of manufacturers, so the code is like
final AjaxCheckBox selectAllCheckbox = new
AjaxCheckBox("manufacturerCheckbox", new
PropertyModel(mTargetModel.getManufacturersAsMap(), manufacturerName))
{
then, when the "remove from right list" button is hit, it removes the
manufacturer value from the list (originally it just set it to false;
is it ok to have the Property return "null" for a checkbox value, to
mean false?) and then adds the checkbox to the AjaxRequestTarget ;
actually it adds a containing span, which also (for now) has a label
w/ a timestamp, so I can see that the whole span containing the
checkbox is being redrawn.
I also updated the Target Model's getManufacturersAsMap() function, so
that it logs when it's called. Oddly (to me, again I might be missing
something here) the getManufacturersAsMap() is called when the page is
constructed and when the checkbox is clicked but NOT when the span
including the checkbox is being redrawn.
Just out of curiosity I've tried this with and without the ListView
setReuseItems set to true. I've made sure that appropriate
setOutputMarkupIds are set (it seems some of the rules for making sure
your nesting wicket:id hierarchy are relaxed in the case of ListViews,
though of course I try to be as faithful as always, still that doesn't
seem to be the problem)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]