You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Tauren Mills <ta...@groovee.com> on 2007/08/15 08:55:48 UTC

Ajax refresh of DefaultDataTable in wicket-phonebook

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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax refresh of DefaultDataTable in wicket-phonebook

Posted by Igor Vaynberg <ig...@gmail.com>.
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 <ta...@tauren.com> 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 <ig...@gmail.com> 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 <ta...@groovee.com> 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 <ig...@gmail.com> 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 <ta...@groovee.com> 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: users-unsubscribe@wicket.apache.org
> > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > >
> > > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Ajax refresh of DefaultDataTable in wicket-phonebook

Posted by Tauren Mills <ta...@tauren.com>.
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 <ig...@gmail.com> 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 <ta...@groovee.com> 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 <ig...@gmail.com> 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 <ta...@groovee.com> 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: users-unsubscribe@wicket.apache.org
> > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > >
> > > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax refresh of DefaultDataTable in wicket-phonebook

Posted by Igor Vaynberg <ig...@gmail.com>.
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 <ta...@groovee.com> 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 <ig...@gmail.com> 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 <ta...@groovee.com> 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: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Ajax refresh of DefaultDataTable in wicket-phonebook

Posted by Tauren Mills <ta...@groovee.com>.
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 <ig...@gmail.com> 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 <ta...@groovee.com> 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: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax refresh of DefaultDataTable in wicket-phonebook

Posted by Igor Vaynberg <ig...@gmail.com>.
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 <ta...@groovee.com> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>