I have experienced the same issue, the only difference is that
when there was no data in the database the dropdown crashed and could
not display any
values, I'm also using AjaxFormComponentUpdatingBehavior onchange
Here is a section of my code:-
final WebMarkupContainer commentListContainer = new
WebMarkupContainer("commentListContainer");
commentListContainer.setOutputMarkupId(true);
final DropDownChoice<String> cats = new DropDownChoice<String>("cat_select",
new PropertyModel<String>(new VComment(), "category")
, category.getCategoriesByType("vcomment"), new ChoiceRenderer<String>());
cats.setOutputMarkupId(true);
add(cats);
final AbstractDataProvider<VComment> dataProvider = (VCommentDataProvider)
getDataProvider(params);
final DataView<VComment> commentView = new DataView<VComment>("commentList",
dataProvider, 10) {
@Override
protected void populateItem(Item<VComment> item) {.....}
}
commentListContainer.add(commentView);
........
cats.add(new AjaxFormComponentUpdatingBehavior("onchange") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
params.put("cat", cats.getModelObject());
getDataProvider(params);
target.addComponent(commentListContainer);
target.addComponent(cats);
}
});
Kimotho.
On Thu, Apr 29, 2010 at 12:42 PM, Ernesto Reinaldo Barreiro <
[email protected]> wrote:
> Can you post the code that was failing somewhere? Maybe someone can
> spot what is happening;-)
>
> Best,
>
> Ernesto
>
> On Thu, Apr 29, 2010 at 11:21 AM, Reinout van Schouwen
> <[email protected]> wrote:
>>
>> Replying to myself.
>>
>> I've worked around the problem by not using the AJAX method to update my
>> DataView but by reloading the page with different pageparameters after a
>> selection instead. Far from ideal, but the best I could come up with.
>>
>> Alternative solutions still welcome!
>>
>> Op maandag 26-04-2010 om 14:20 uur [tijdzone +0200], schreef Reinout van
>> Schouwen:
>>> I'm having trouble figuring out the following problem.
>>>
>>> I have a div (coupled to a WebMarkupContainer) containing a form and a
>>> list. The list is populated with a DataView, which gets its data from a
>>> SortableDataProvider that I have implemented according to the repeater
>>> examples provided on wicket-library.com.
>>>
>>> What I want to do is to change the sort order based on a user selection
>>> from a DropDownChoice in the form. I've used an
>>> AjaxFormComponentUpdatingBehavior to listen to the dropdown's onchange
>>> event. In the onUpdate() method I change the sortparam in the
>>> dataprovider according to the selection and then add the container div
>>> to the AjaxRequestTarget.
>>>
>>> What I expect to happen is that the DataView updates to reflect the new
>>> sort order. What actually happens is that the DataView completely
>>> disappears from the page! (The Wicket Ajax Debug window shows me that
>>> the spot where the list should be in the HTML within the ajax-response
>>> is indeed empty.)
>>>
>>> I've already set the outputmarkupid and the outputmarkupplaceholdertag
>>> properties on the container to true but that makes no difference.
>>>
>>> Any ideas are appreciated!
>>>
>>> regards,
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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]
>
>