You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by DaveS <da...@gmail.com> on 2013/07/17 09:16:14 UTC

Table with a lot of ajax links

Hi guys,
I am making table of some items. Table component is default wicket
DataTable. Table page size is 100 items per page and data have several
pagings. So that is easy.

Now I would like to add 5 ajax links related to row item. That is also no
problem and easy and everythings works fine.

But when I exploring page rendered HTML source, I see a lot of ajax event
bindings. (exactly 500 = 100 * 5)

Wicket.Ajax.ajax({"u":"./links?2-1.IBehaviorListener.0-c1~link","e":"click","c":"id4"});;
Wicket.Ajax.ajax({"u":"./links?2-1.IBehaviorListener.0-c2~link","e":"click","c":"id5"});;
....

I understand how it works, but I would like to ask if you know some solution
how reduce large amounts of events binding, because I am affraid about page
loading performance with this huge count of bindings.

Thanks for your advice.

Dave



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Table-with-a-lot-of-ajax-links-tp4660303.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Table with a lot of ajax links

Posted by Cedric Gatay <ga...@gmail.com>.
Hi,
you can have a look at what Martin Grigorov is doing on https://issues.apache.org/jira/browse/WICKET-5267. It's exactly what you are talking about.

Regards,

On 17 juillet 2013 at 09:17:52, DaveS (david.skuben@gmail.com) wrote:

Hi guys,  
I am making table of some items. Table component is default wicket  
DataTable. Table page size is 100 items per page and data have several  
pagings. So that is easy.  

Now I would like to add 5 ajax links related to row item. That is also no  
problem and easy and everythings works fine.  

But when I exploring page rendered HTML source, I see a lot of ajax event  
bindings. (exactly 500 = 100 * 5)  

Wicket.Ajax.ajax({"u":"./links?2-1.IBehaviorListener.0-c1~link","e":"click","c":"id4"});;  
Wicket.Ajax.ajax({"u":"./links?2-1.IBehaviorListener.0-c2~link","e":"click","c":"id5"});;  
....  

I understand how it works, but I would like to ask if you know some solution  
how reduce large amounts of events binding, because I am affraid about page  
loading performance with this huge count of bindings.  

Thanks for your advice.  

Dave  



--  
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Table-with-a-lot-of-ajax-links-tp4660303.html  
Sent from the Users forum mailing list archive at Nabble.com.  

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

__
Cedric Gatay (@Cedric_Gatay)
http://code-troopers.com | http://www.bloggure.info | http://cedric.gatay.fr

Re: Table with a lot of ajax links

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
I can also try to pack the project as a jar file (so, that is is reusable)
and move it to wicket-stuff or some other place that gets regularly
published.


On Wed, Aug 7, 2013 at 8:45 AM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:

> Hi,
>
> Thanks for the feedback.
>
> In fact, solution can be improved in many aspects. For instance, I thought
> about making the "logic" pluggable so that you can support more that just
> links... Maybe having a "handler" interface that can be registered on
> "context" component and is responsible for
>
> 1- The header contributions needed by the "links". I write "links" because
> they might be anything.
> 2- A method to  decides is a particular AJAX request can be handled by the
> given handler.
> 3- A logic to deliver the event to the appropriate component(s).
>
> This way we might have something "generic" and "extendable". For instance,
> that could be used to register drag-drop events or anything you need.
>
> If interesting to other people I can give it a try to this idea and
> publish the code (and try to write something to explain the design). Mind
> example is a table but behavior can be attached to "any"  component.
>
>
>
>
> On Wed, Aug 7, 2013 at 12:19 AM, Rodrigo Heffner <
> rodrigo.heffner@gmail.com> wrote:
>
>> Thank you very much, Ernesto.
>>
>> I have a similar scenario, a panel with about 300 AjaxFallbackLinks and
>> each with some custom logic on the onClick, but your solution looks much
>> better.
>>
>>
>> On 5 August 2013 17:31, Ernesto Reinaldo Barreiro <reiern70@gmail.com
>> >wrote:
>>
>> > Dave,
>> >
>> > Mind that is  just something I improvise in a couple of hours... based
>> on
>> > previous experiences.  For, sure you will find many ways to improve
>> it;-).
>> > Also if you have questions I will try to answer them here.
>> >
>> >
>> > On Mon, Aug 5, 2013 at 7:06 PM, DaveS <da...@gmail.com> wrote:
>> >
>> > > Hi Ernesto,
>> > > thank you for example. I am sure that it helps also other wicket
>> users.
>> > >
>> > > I will use it and if I improve something I will let you know.
>> > >
>> > > Thanks again.
>> > >
>> > > Dave
>> > >
>> > >
>> > >
>> > > --
>> > > View this message in context:
>> > >
>> >
>> http://apache-wicket.1842946.n4.nabble.com/Table-with-a-lot-of-ajax-links-tp4660303p4660712.html
>> > > Sent from the Users forum mailing list archive at Nabble.com.
>> > >
>> > > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > > For additional commands, e-mail: users-help@wicket.apache.org
>> > >
>> > >
>> >
>> >
>> > --
>> > Regards - Ernesto Reinaldo Barreiro
>> >
>>
>>
>>
>> --
>> Rodrigo H M Bezerra
>>
>
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>



-- 
Regards - Ernesto Reinaldo Barreiro

Re: Table with a lot of ajax links

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Hi,

Thanks for the feedback.

In fact, solution can be improved in many aspects. For instance, I thought
about making the "logic" pluggable so that you can support more that just
links... Maybe having a "handler" interface that can be registered on
"context" component and is responsible for

1- The header contributions needed by the "links". I write "links" because
they might be anything.
2- A method to  decides is a particular AJAX request can be handled by the
given handler.
3- A logic to deliver the event to the appropriate component(s).

This way we might have something "generic" and "extendable". For instance,
that could be used to register drag-drop events or anything you need.

If interesting to other people I can give it a try to this idea and publish
the code (and try to write something to explain the design). Mind example
is a table but behavior can be attached to "any"  component.




On Wed, Aug 7, 2013 at 12:19 AM, Rodrigo Heffner
<ro...@gmail.com>wrote:

> Thank you very much, Ernesto.
>
> I have a similar scenario, a panel with about 300 AjaxFallbackLinks and
> each with some custom logic on the onClick, but your solution looks much
> better.
>
>
> On 5 August 2013 17:31, Ernesto Reinaldo Barreiro <reiern70@gmail.com
> >wrote:
>
> > Dave,
> >
> > Mind that is  just something I improvise in a couple of hours... based on
> > previous experiences.  For, sure you will find many ways to improve
> it;-).
> > Also if you have questions I will try to answer them here.
> >
> >
> > On Mon, Aug 5, 2013 at 7:06 PM, DaveS <da...@gmail.com> wrote:
> >
> > > Hi Ernesto,
> > > thank you for example. I am sure that it helps also other wicket users.
> > >
> > > I will use it and if I improve something I will let you know.
> > >
> > > Thanks again.
> > >
> > > Dave
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > >
> >
> http://apache-wicket.1842946.n4.nabble.com/Table-with-a-lot-of-ajax-links-tp4660303p4660712.html
> > > Sent from the Users forum mailing list archive at Nabble.com.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> >
> > --
> > Regards - Ernesto Reinaldo Barreiro
> >
>
>
>
> --
> Rodrigo H M Bezerra
>



-- 
Regards - Ernesto Reinaldo Barreiro

Re: Table with a lot of ajax links

Posted by Rodrigo Heffner <ro...@gmail.com>.
Thank you very much, Ernesto.

I have a similar scenario, a panel with about 300 AjaxFallbackLinks and
each with some custom logic on the onClick, but your solution looks much
better.


On 5 August 2013 17:31, Ernesto Reinaldo Barreiro <re...@gmail.com>wrote:

> Dave,
>
> Mind that is  just something I improvise in a couple of hours... based on
> previous experiences.  For, sure you will find many ways to improve it;-).
> Also if you have questions I will try to answer them here.
>
>
> On Mon, Aug 5, 2013 at 7:06 PM, DaveS <da...@gmail.com> wrote:
>
> > Hi Ernesto,
> > thank you for example. I am sure that it helps also other wicket users.
> >
> > I will use it and if I improve something I will let you know.
> >
> > Thanks again.
> >
> > Dave
> >
> >
> >
> > --
> > View this message in context:
> >
> http://apache-wicket.1842946.n4.nabble.com/Table-with-a-lot-of-ajax-links-tp4660303p4660712.html
> > Sent from the Users forum mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>



-- 
Rodrigo H M Bezerra

Re: Table with a lot of ajax links

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Dave,

Mind that is  just something I improvise in a couple of hours... based on
previous experiences.  For, sure you will find many ways to improve it;-).
Also if you have questions I will try to answer them here.


On Mon, Aug 5, 2013 at 7:06 PM, DaveS <da...@gmail.com> wrote:

> Hi Ernesto,
> thank you for example. I am sure that it helps also other wicket users.
>
> I will use it and if I improve something I will let you know.
>
> Thanks again.
>
> Dave
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Table-with-a-lot-of-ajax-links-tp4660303p4660712.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Regards - Ernesto Reinaldo Barreiro

Re: Table with a lot of ajax links

Posted by DaveS <da...@gmail.com>.
Hi Ernesto, 
thank you for example. I am sure that it helps also other wicket users.

I will use it and if I improve something I will let you know.

Thanks again.

Dave



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Table-with-a-lot-of-ajax-links-tp4660303p4660712.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Table with a lot of ajax links

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Hi,

I have just added an example that seems to work. See

https://github.com/reiern70/antilia-bits/tree/master/wicket-sparelinks

Hope this helps.



On Fri, Aug 2, 2013 at 6:51 PM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:

> Let me see if I can spend a couple of hours on it during the night. I will
> hang it somewhere in github..
>
>
> On Fri, Aug 2, 2013 at 5:42 PM, Brian Welnack <
> brian.welnack@mediadriver.com> wrote:
>
>> I have some work coming up that could benefit from such an example as
>> well...
>>
>>
>> On Fri, Aug 2, 2013 at 12:56 AM, Ernesto Reinaldo Barreiro <
>> reiern70@gmail.com> wrote:
>>
>> > Hi,
>> >
>> > Do you want me to build an example? That might be easier that explaining
>> > all details... You can then adapt the example to your needs... and it
>> might
>> > be useful to other people as well.
>> >
>> >
>> > On Fri, Aug 2, 2013 at 12:37 AM, DaveS <da...@gmail.com> wrote:
>> >
>> > > Hi Ernesto,
>> > >
>> > > please can you give me som example codes of yours
>> "AbstarctAjaxBehavior"
>> > > and
>> > > "special link components".
>> > >
>> > > I am trying to do it, but I am little bit lost.
>> > >
>> > > Thanks a lot.
>> > >
>> > > Dave
>> > >
>> > >
>> > >
>> > > --
>> > > View this message in context:
>> > >
>> >
>> http://apache-wicket.1842946.n4.nabble.com/Table-with-a-lot-of-ajax-links-tp4660303p4660633.html
>> > > Sent from the Users forum mailing list archive at Nabble.com.
>> > >
>> > > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > > For additional commands, e-mail: users-help@wicket.apache.org
>> > >
>> > >
>> >
>> >
>> > --
>> > Regards - Ernesto Reinaldo Barreiro
>> >
>>
>
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>



-- 
Regards - Ernesto Reinaldo Barreiro

Re: Table with a lot of ajax links

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Let me see if I can spend a couple of hours on it during the night. I will
hang it somewhere in github..


On Fri, Aug 2, 2013 at 5:42 PM, Brian Welnack <brian.welnack@mediadriver.com
> wrote:

> I have some work coming up that could benefit from such an example as
> well...
>
>
> On Fri, Aug 2, 2013 at 12:56 AM, Ernesto Reinaldo Barreiro <
> reiern70@gmail.com> wrote:
>
> > Hi,
> >
> > Do you want me to build an example? That might be easier that explaining
> > all details... You can then adapt the example to your needs... and it
> might
> > be useful to other people as well.
> >
> >
> > On Fri, Aug 2, 2013 at 12:37 AM, DaveS <da...@gmail.com> wrote:
> >
> > > Hi Ernesto,
> > >
> > > please can you give me som example codes of yours
> "AbstarctAjaxBehavior"
> > > and
> > > "special link components".
> > >
> > > I am trying to do it, but I am little bit lost.
> > >
> > > Thanks a lot.
> > >
> > > Dave
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > >
> >
> http://apache-wicket.1842946.n4.nabble.com/Table-with-a-lot-of-ajax-links-tp4660303p4660633.html
> > > Sent from the Users forum mailing list archive at Nabble.com.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> >
> > --
> > Regards - Ernesto Reinaldo Barreiro
> >
>



-- 
Regards - Ernesto Reinaldo Barreiro

Re: Table with a lot of ajax links

Posted by Brian Welnack <br...@mediadriver.com>.
I have some work coming up that could benefit from such an example as
well...


On Fri, Aug 2, 2013 at 12:56 AM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:

> Hi,
>
> Do you want me to build an example? That might be easier that explaining
> all details... You can then adapt the example to your needs... and it might
> be useful to other people as well.
>
>
> On Fri, Aug 2, 2013 at 12:37 AM, DaveS <da...@gmail.com> wrote:
>
> > Hi Ernesto,
> >
> > please can you give me som example codes of yours "AbstarctAjaxBehavior"
> > and
> > "special link components".
> >
> > I am trying to do it, but I am little bit lost.
> >
> > Thanks a lot.
> >
> > Dave
> >
> >
> >
> > --
> > View this message in context:
> >
> http://apache-wicket.1842946.n4.nabble.com/Table-with-a-lot-of-ajax-links-tp4660303p4660633.html
> > Sent from the Users forum mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>

Re: Table with a lot of ajax links

Posted by DaveS <da...@gmail.com>.
Yes, It will be great. 

Thanks a lot Ernesto.



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Table-with-a-lot-of-ajax-links-tp4660303p4660647.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Table with a lot of ajax links

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Hi,

Do you want me to build an example? That might be easier that explaining
all details... You can then adapt the example to your needs... and it might
be useful to other people as well.


On Fri, Aug 2, 2013 at 12:37 AM, DaveS <da...@gmail.com> wrote:

> Hi Ernesto,
>
> please can you give me som example codes of yours "AbstarctAjaxBehavior"
> and
> "special link components".
>
> I am trying to do it, but I am little bit lost.
>
> Thanks a lot.
>
> Dave
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Table-with-a-lot-of-ajax-links-tp4660303p4660633.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Regards - Ernesto Reinaldo Barreiro

Re: Table with a lot of ajax links

Posted by DaveS <da...@gmail.com>.
Hi Ernesto,

please can you give me som example codes of yours "AbstarctAjaxBehavior" and
"special link components".

I am trying to do it, but I am little bit lost.

Thanks a lot.

Dave



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Table-with-a-lot-of-ajax-links-tp4660303p4660633.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Table with a lot of ajax links

Posted by DaveS <da...@gmail.com>.
Thanks guys, that's exactly what I am looking for.

Dave



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Table-with-a-lot-of-ajax-links-tp4660303p4660308.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Table with a lot of ajax links

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
The same approach was used for things like dragging cells around... and
many other dirty tricks... If you do this in an organized manner you could
still have something that is not 100% the wicekt way but still have some
nice "componentization".

As Cedric said martin is working to deliver something generic.


On Wed, Jul 17, 2013 at 11:25 AM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:

> Hi,
>
> For some application with very big tables with lots of links and AJAXy
> things I have done the following.
>
> 1- Place a an AbstarctAjaxBehavior at table level.
> 2- Create special link components that all what they do I submit info
> about their ID to this unique AbstarctAjaxBehavior.
> 3- On server side you can use a visitor, on unique AJAX behavior,  to
> locate the instance of the "special link" and deliver the event to it.
>
> This reduced a lot the amount of java script to stream to the client and
> made component very responsible.
>
>
>
>
> On Wed, Jul 17, 2013 at 11:16 AM, DaveS <da...@gmail.com> wrote:
>
>> Hi guys,
>> I am making table of some items. Table component is default wicket
>> DataTable. Table page size is 100 items per page and data have several
>> pagings. So that is easy.
>>
>> Now I would like to add 5 ajax links related to row item. That is also no
>> problem and easy and everythings works fine.
>>
>> But when I exploring page rendered HTML source, I see a lot of ajax event
>> bindings. (exactly 500 = 100 * 5)
>>
>>
>> Wicket.Ajax.ajax({"u":"./links?2-1.IBehaviorListener.0-c1~link","e":"click","c":"id4"});;
>>
>> Wicket.Ajax.ajax({"u":"./links?2-1.IBehaviorListener.0-c2~link","e":"click","c":"id5"});;
>> ....
>>
>> I understand how it works, but I would like to ask if you know some
>> solution
>> how reduce large amounts of events binding, because I am affraid about
>> page
>> loading performance with this huge count of bindings.
>>
>> Thanks for your advice.
>>
>> Dave
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/Table-with-a-lot-of-ajax-links-tp4660303.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>



-- 
Regards - Ernesto Reinaldo Barreiro

Re: Table with a lot of ajax links

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Hi,

For some application with very big tables with lots of links and AJAXy
things I have done the following.

1- Place a an AbstarctAjaxBehavior at table level.
2- Create special link components that all what they do I submit info about
their ID to this unique AbstarctAjaxBehavior.
3- On server side you can use a visitor, on unique AJAX behavior,  to
locate the instance of the "special link" and deliver the event to it.

This reduced a lot the amount of java script to stream to the client and
made component very responsible.




On Wed, Jul 17, 2013 at 11:16 AM, DaveS <da...@gmail.com> wrote:

> Hi guys,
> I am making table of some items. Table component is default wicket
> DataTable. Table page size is 100 items per page and data have several
> pagings. So that is easy.
>
> Now I would like to add 5 ajax links related to row item. That is also no
> problem and easy and everythings works fine.
>
> But when I exploring page rendered HTML source, I see a lot of ajax event
> bindings. (exactly 500 = 100 * 5)
>
>
> Wicket.Ajax.ajax({"u":"./links?2-1.IBehaviorListener.0-c1~link","e":"click","c":"id4"});;
>
> Wicket.Ajax.ajax({"u":"./links?2-1.IBehaviorListener.0-c2~link","e":"click","c":"id5"});;
> ....
>
> I understand how it works, but I would like to ask if you know some
> solution
> how reduce large amounts of events binding, because I am affraid about page
> loading performance with this huge count of bindings.
>
> Thanks for your advice.
>
> Dave
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Table-with-a-lot-of-ajax-links-tp4660303.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Regards - Ernesto Reinaldo Barreiro