On Feb 3, 5:39 pm, Brandon Aaron <[EMAIL PROTECTED]> wrote:
> Ugh ... large tables always needs lots of optimizations. First ...
> you'll want to minimize the number of .append()s. Concat all your HTML
> into an array and then append. Something like this:
>
> var html = [];
> ...
>
Thanks.

> cause issues of their own. Here is a new plugin that handles event
> delegation rather 
> elegantly:http://dev.jquery.com/browser/trunk/plugins/delegate/jquery.delegate.js
>
> You'd need to use it like this:
>
> $('#eintragsliste')
>     .delegate('click', '.expanding', collapser_expand_all)
>     .delegate('click', '.collapsing', collapser_collapse_all);
>
Well I've 2 issues, one is collapsing/expanding all entries at once
(as shown above), the second is collapsing/expanding each single entry
separately. Therefore I need to bind to each image in each entry
itself.

 '<tr><td><table id="'+i+'"><tbody>' +
 '  <tr>' +
 '    <td><img class="expanding" src="images/plus01.png"></th>' +
 '    <td>...</td>' +
 '  </tr><tr class="expanded">' +
 '    <td>&nbsp;</td>' +
 '    <td>...</td>' +
 '  </tr>' +
 '</tbody></table></td></tr>');
 $('#eintragsliste')
     .delegate('click', '.expanding', '#'+i, collapser_expand(i))
     .delegate('click', '.collapsing', '#'+i, collapser_collapse(i));

IMO it would be best if I were able to access jquery functions
generally  in normal HTML through the "onclick" clause. This would
allow me to build a collapser plugin which could collapse/expand not
only tables but anything (e.g. forms, etc). All the user has to define
which collapse/expand class belongs to which collaping/expanding
event. Theres no need to have the collapsing/expanding object within
the collapsed/expanded object as long as they are linked somehow
through their id. So all what's needed is something like

  onclick="$(...).collapser_collapse (i)"

where i is the id of the object containing all collapsing objects
(marked with class="expanded"). Unfortunately I haven't been able to
figure that out so far so I tried it with bind/live query/etc. Besides
the onclick probably is faster at least with large tables.

O. Wyss

Reply via email to