[jQuery] Re: What is the easiest way to add events to dynamically added rows?

2008-02-21 Thread Travis Fisher

Dan,

I am planning on taking a look at Listen, but I was wondering if the
Delegate plugin has the same functionality as Listen. The reason I'm
inquiring about Delegate is because I am using the Validation plugin,
which requires Delegate.

Thanks for your help.

Travis

On Feb 20, 2:38 pm, Dan G. Switzer, II [EMAIL PROTECTED]
wrote:
 I am dynamically removing and adding rows using AJAX calls.

 Is it still a better idea to go with Listen?

 IMO, yes. You won't have the polling overhead like you do with LiveQuery.
 The $.Listen() plug-in only attaches itself once and then just listens for
 matching key events on it's children to see if it should trigger off a
 callback.

 IMO this is much cleaner solution and it's less likely to introduce any kind
 of memory leaks (since there's only one event ever attached.)

 -Dan


[jQuery] Re: What is the easiest way to add events to dynamically added rows?

2008-02-21 Thread whylom

Wow - I asked Ariel Flesler (the developer of the Listen plugin) to
explain why one would use it instead of LiveQuery.  His response was
way more cryptic than yours.  Thanks for cutting through the haze,
Dan!

On Feb 20, 2:38 pm, Dan G. Switzer, II [EMAIL PROTECTED]
wrote:
 I am dynamically removing and adding rows using AJAX calls.

 Is it still a better idea to go with Listen?

 IMO, yes. You won't have the polling overhead like you do with LiveQuery.
 The $.Listen() plug-in only attaches itself once and then just listens for
 matching key events on it's children to see if it should trigger off a
 callback.

 IMO this is much cleaner solution and it's less likely to introduce any kind
 of memory leaks (since there's only one event ever attached.)

 -Dan


[jQuery] Re: What is the easiest way to add events to dynamically added rows?

2008-02-21 Thread Dan G. Switzer, II

Travis,

I am planning on taking a look at Listen, but I was wondering if the
Delegate plugin has the same functionality as Listen. The reason I'm
inquiring about Delegate is because I am using the Validation plugin,
which requires Delegate.

Thanks for your help.

It looks like Delegate provides similar functionality (although Listen
offers more functionality.) However, if you're only interested in attaching
behaviors to elements,with no need to remove events, than Delegate should do
the job nicely.

-Dan



[jQuery] Re: What is the easiest way to add events to dynamically added rows?

2008-02-21 Thread Ariel Flesler

@whylom
  Sorry if my reply was cryptic (I don't remember when). The thing is
I already answered that question a few times. I'll throw in a few
differences, but let me say both are good plugins, they help on
similar situations with different approaches. Note that I haven't ever
used LiveQuery so I cannot say much, I'll just say what I know, read
both documentations if you want a fairer comparation.

LiveQuery is easier to use, as in, you don't need much understanding,
it just does what it is meant to do. It's more reliable to, as it
works for any event and any selector. Also it allows to execute
functions when elements are added/removed, sort of like Firefox's
Mutation events. It surely has more pros but as I said, I've never
used it, so that's all I know.

Listen is light, and fast. Is designed to be almost 100% scalable.
Meaning it doesn't matter if you register 20 selectors to the same
element/event. It should take nearly the same time to evaluate when
the event comes. Also, as Dan said,  it binds initially and then just
listens, this also contributes to scalability.
On the other hand, some events cannot be handled because they don't
bubble. Luckily blur and focus (which are oftenly needed) can now be
handled with Listen.

Well, that's it. Thanks Dan for supporting Listen :)

Cheers

Ariel Flesler

On 21 feb, 12:56, whylom [EMAIL PROTECTED] wrote:
 Wow - I asked Ariel Flesler (the developer of the Listen plugin) to
 explain why one would use it instead of LiveQuery.  His response was
 way more cryptic than yours.  Thanks for cutting through the haze,
 Dan!

 On Feb 20, 2:38 pm, Dan G. Switzer, II [EMAIL PROTECTED]
 wrote:



  I am dynamically removing and adding rows using AJAX calls.

  Is it still a better idea to go with Listen?

  IMO, yes. You won't have the polling overhead like you do with LiveQuery.
  The $.Listen() plug-in only attaches itself once and then just listens for
  matching key events on it's children to see if it should trigger off a
  callback.

  IMO this is much cleaner solution and it's less likely to introduce any kind
  of memory leaks (since there's only one event ever attached.)

  -Dan- Ocultar texto de la cita -

 - Mostrar texto de la cita -