On 3/3/06, Frank Silbermann <[EMAIL PROTECTED]> wrote:
IDataProvider is only an interface, the back end you can implement however you want. It can read properties on your page set by other components, etc.
yes.
panel is the basic piece of wicket composition. so you will use them often. for some situation (when the panel is not really reusable outside the page) you might want to use Fragments because they make things tidier and easier.
-Igor
Me:
>> However, at any time the user can re-set the options and re-submit,
>> causing a completely different DataTable based on a new DataProvider.
Eelco Hillenius:
> First of all, ask yourself whether it is a completely different
> datatable, or whether the it's just a different model.
Suppose it's just a different model. DataTable seems to have no
constructor that takes a PropertyModel so that the IDataProvider can
change dynamically, nor a method in DataTable to replace the
IDataProvider manually.
In this case, would you recommend simply to changing the state of my
IDataProvider so that "IDataProvider.iterator(first, count)" method
returns the new data, and call " DataTable.setCurrentPage(1)"?
IDataProvider is only an interface, the back end you can implement however you want. It can read properties on your page set by other components, etc.
Me:
>> How do I code a page to replace one component with a new one
>> in response to user input? (I see plenty of examples of adding
>> a component to a page, but only in the constructor -- and no
>> examples of removing/replacing a component.)
Eelco Hillenius:
> If it *is* a completely different datatable and you want to
> replace it with something completely different, use panels.
> Put your different options in different panels, and use
> 'replace' to replace one component with the other.
Would that be the " MarkupContainer.replace(component)" method? This
method returns a MarkupContainer -- is the return value merely "self" --
a convenience in case you want to replace several components in one
line?
yes.
I can see the motivation for putting my replaceable components in a
Panel if the HTML requirements differ. Likewise, if I have enough
components to replace that I'd rather not have to replace them one at a
time. But if it's just a single component that I'm replacing, is there
really any need to put it in its own panel?
panel is the basic piece of wicket composition. so you will use them often. for some situation (when the panel is not really reusable outside the page) you might want to use Fragments because they make things tidier and easier.
-Igor