constructor cant since at that point you havent been added to the form yet.
but onbeforerender() can.
onbeforerender() { if (findParent(Form.class)==null) { throw .... }
super.onbeforerender(); }
-igor
On 8/16/07, Tauren Mills <[EMAIL PROTECTED]> wrote:
>
> Sure, that makes sense. So to clarify, it is up to the user to
> include a form around the datatable if they want to include a
> filtertoolbar?
>
> To test for this requirement, would the constructor of filtertoolbar
> check to see if one of its parents is a Form? Or a
> IFormSubmitListener? I can write something to test this, but is there
> a built-in wicket way to do this already?
>
> Thanks,
> Tauren
>
> On 8/16/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > i guess what needs to be done is that FilterForm should go away,
> whatever it
> > does now should be moved into filtertoolbar. then a requirement to
> adding
> > filtertoolbar to the table is that that table itself is wrapped in a
> form.
> > makes sense?
> >
> > -igor
> >
> >
> > On 8/16/07, Tauren Mills <[EMAIL PROTECTED]> wrote:
> > >
> > > Igor,
> > >
> > > How would you suggest doing this refactor? The form really should go
> > > outside of the table, but that puts it outside the realm of
> > > DefatultDataTable since the wicket:id for it is on a <table> tag. If
> > > DefaultDataTable does add the form somehow, what about when you don't
> > > want filtering? Then the table is wrapped in a form for no reason.
> > >
> > > Then again, there are situations where checkboxes in each row could be
> > > needed, thus requiring a form around the whole table. So even if the
> > > FilterToolbar is not added, the form could still be needed. It
> > > wouldn't harm anything to have an extra form around it that isn't used
> > > I suppose.
> > >
> > > I'll do the refactoring if you can provide some suggestions or
> > > guidance. I'm thinking of something along the line of having the
> > > DefaultDataTable wicket:id be in a <div> and the DataTable.html markup
> > > would include <form ...> and <table ...> tags. But you developed this
> > > thing and probably have much better ideas.
> > >
> > > Thanks,
> > > Tauren
> > >
> > >
> > >
> > >
> > > On 8/15/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > > > yes, i believe it is caused by invalid markup, maybe the form should
> be
> > > > factored out and put around the entire table.
> > > >
> > > > -igor
> > > >
> > > >
> > > > On 8/14/07, Tauren Mills <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > For some reason when I do an ajax refresh of the DefaultDataTable
> in
> > > > > wicket-phonebook, the FilterToolbar disappears. I see it in the
> Ajax
> > > > > Debugger, but it doesn't display on the screen. This is only
> > > > > happening in FF, not IE (only tested on WinXP).
> > > > >
> > > > > I cannot see any difference between the html that is rendered when
> the
> > > > > page is loaded vs. when the ajax refresh happens. But FF decides
> to
> > > > > not render the FilterToolbar after the ajax refresh, while IE does
> > > > > render it.
> > > > >
> > > > > I'm wondering if FF has issues with invalid HTML? The
> FilterToolbar
> > > > > puts a <form> around a <tr></tr> and adds a span inside the form,
> but
> > > > > outside the <tr></tr>. However, I don't understand why it would
> only
> > > > > have a problem after the ajax render and not the original page
> render.
> > > > >
> > > > > Here are the only code changes to ListContactsPage::
> > > > >
> > > > > public ListContactsPage() {
> > > > > addCreateLink();
> > > > > IColumn[] columns = createColumns();
> > > > > // set up data provider
> > > > > ContactsDataProvider dataProvider = new
> > > ContactsDataProvider(dao);
> > > > > // create the data table
> > > > > final DefaultDataTable users = new
> DefaultDataTable("users",
> > > > > Arrays
> > > > > .asList(columns), dataProvider, 10);
> > > > > users.addTopToolbar(new FilterToolbar(users,
> dataProvider));
> > > > > users.setOutputMarkupId(true);
> > > > > add(users);
> > > > >
> > > > > add(new AjaxLink("refresh") {
> > > > > @Override
> > > > > public void onClick(AjaxRequestTarget target)
> > > > > {
> > > > > target.addComponent(users);
> > > > > }
> > > > > });
> > > > > }
> > > > >
> > > > > And add this to the markup:
> > > > >
> > > > > <a href="#" wicket:id="refresh">Refresh</a>
> > > > >
> > > > > Note that this is a simple case to illustrate the problem. In my
> > > > > case, I'm using ModalWindows to edit the data, and on window
> close,
> > > > > the data table is refreshed.
> > > > >
> > > > > Any idea what is causing this? Is it the invalid markup? Any
> > > > > thoughts on a solution?
> > > > >
> > > > > Thanks,
> > > > > Tauren
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > 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]
>
>