[jQuery] Re: Tablesorter and event handlers on table rows
Don't take this the wrong way, but I love you man, everything works great, thanks a lot :) On Nov 29, 9:10 am, "Christian Bach" <[EMAIL PROTECTED]> wrote: > Hi Guys, > > This issue has been resolved in the latest tablesorter release. > > Get it from:http://tablesorter.com/ > > /Christian > > 2007/11/29, pambuk <[EMAIL PROTECTED]>: > > > > > Hi, > > > I have the exact same problem and frankly, I'm out of ideas. > > Last thing I tried was writing a widget, to rebind events, but clicks > > are fired n+1 number of sortings. > > > I'm a JS (and jQuery) noob, but I'd really appreciate a solution / > > workaround / hack / whatever. > > > I guess I'll sort the table through ajax or even reload the page :/, > > too bad, because I really liked the idea of using tablesorter. > > > Raymond, could you please describe your workaround? > > > On Nov 8, 3:20 pm, Raymond78 <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > First, a big thanks for creating this great plugin! Very nice. > > > > I am using TableSorter 2.0 on a table which contains rows on which I > > > have added some event handlers (using jquery; the events have nothing > > > to do with sorting, they're for highlighting and processing clicks). > > > > These event handlers work fine, until I click on a column heading to > > > sort the table. The sorting works fine, but the event handlers don't > > > work anymore. After having a look at the sourcecode, it seems to me > > > that TableSorter effectively removes any event handlers because of the > > > way it sorts the table. I studied all documentation and examples, but > > > I couldn't find anything to do this. (There is something to trigger > > > sorting, but that is the other way around.) > > > > My question is, is this correct, or am I overlooking something here? > > > Is there is any way to preserve the row event handlers? > > > > For now, I have created a small workaround by passing an extra > > > parameter that contains a function call, which is called after the > > > sorting is finished; but if there is already a way to do this I'd like > > > to know. > > > > I hope someone can help me out. Thanks in advance. > > > > Kind regards, > > > > Raymond
[jQuery] Re: Tablesorter and event handlers on table rows
Hi Guys, This issue has been resolved in the latest tablesorter release. Get it from: http://tablesorter.com/ /Christian 2007/11/29, pambuk <[EMAIL PROTECTED]>: > > > Hi, > > I have the exact same problem and frankly, I'm out of ideas. > Last thing I tried was writing a widget, to rebind events, but clicks > are fired n+1 number of sortings. > > I'm a JS (and jQuery) noob, but I'd really appreciate a solution / > workaround / hack / whatever. > > I guess I'll sort the table through ajax or even reload the page :/, > too bad, because I really liked the idea of using tablesorter. > > Raymond, could you please describe your workaround? > > > On Nov 8, 3:20 pm, Raymond78 <[EMAIL PROTECTED]> wrote: > > Hi, > > > > First, a big thanks for creating this great plugin! Very nice. > > > > I am using TableSorter 2.0 on a table which contains rows on which I > > have added some event handlers (using jquery; the events have nothing > > to do with sorting, they're for highlighting and processing clicks). > > > > These event handlers work fine, until I click on a column heading to > > sort the table. The sorting works fine, but the event handlers don't > > work anymore. After having a look at the sourcecode, it seems to me > > that TableSorter effectively removes any event handlers because of the > > way it sorts the table. I studied all documentation and examples, but > > I couldn't find anything to do this. (There is something to trigger > > sorting, but that is the other way around.) > > > > My question is, is this correct, or am I overlooking something here? > > Is there is any way to preserve the row event handlers? > > > > For now, I have created a small workaround by passing an extra > > parameter that contains a function call, which is called after the > > sorting is finished; but if there is already a way to do this I'd like > > to know. > > > > I hope someone can help me out. Thanks in advance. > > > > Kind regards, > > > > Raymond >
[jQuery] Re: Tablesorter and event handlers on table rows
Hi, I have the exact same problem and frankly, I'm out of ideas. Last thing I tried was writing a widget, to rebind events, but clicks are fired n+1 number of sortings. I'm a JS (and jQuery) noob, but I'd really appreciate a solution / workaround / hack / whatever. I guess I'll sort the table through ajax or even reload the page :/, too bad, because I really liked the idea of using tablesorter. Raymond, could you please describe your workaround? On Nov 8, 3:20 pm, Raymond78 <[EMAIL PROTECTED]> wrote: > Hi, > > First, a big thanks for creating this great plugin! Very nice. > > I am using TableSorter 2.0 on a table which contains rows on which I > have added some event handlers (using jquery; the events have nothing > to do with sorting, they're for highlighting and processing clicks). > > These event handlers work fine, until I click on a column heading to > sort the table. The sorting works fine, but the event handlers don't > work anymore. After having a look at the sourcecode, it seems to me > that TableSorter effectively removes any event handlers because of the > way it sorts the table. I studied all documentation and examples, but > I couldn't find anything to do this. (There is something to trigger > sorting, but that is the other way around.) > > My question is, is this correct, or am I overlooking something here? > Is there is any way to preserve the row event handlers? > > For now, I have created a small workaround by passing an extra > parameter that contains a function call, which is called after the > sorting is finished; but if there is already a way to do this I'd like > to know. > > I hope someone can help me out. Thanks in advance. > > Kind regards, > > Raymond
[jQuery] Re: Tablesorter and event handlers on table rows
Maybe I should have mentioned this, but in my case, I'm using hoverIntent, trying to write a sort of flyover context menu for each table row. Is the event object and it's target and so on available to me in the callback functions? I wish I actually knew what I was doing... Nat On Nov 9, 8:17 am, Suni <[EMAIL PROTECTED]> wrote: > Wouldn't it be best (bug or no bug) to just bind the event to the > tbody or table element, and check the clicked row from event.target? > This method only needs one event handler binding regardless of the > number of rows (so performance is better), it works even when you add > rows dynamically, and it doesn't matter if tablesorting does something > with the rows. > > Quick code example follows (remove a table row when clicked): > > HTML: > > > > foo bar > > > foo bar > > > foo bar > > > > > Javascript (place in $(document).ready(function() { ... } ); ) > > $('#myTable tbody').bind('click',function(e) > { >var clicked_row = $(e.target).parent(); // Get the parent, since > e.target points to the td-element >clicked_row.remove(); > > });
[jQuery] Re: Tablesorter and event handlers on table rows
Wouldn't it be best (bug or no bug) to just bind the event to the tbody or table element, and check the clicked row from event.target? This method only needs one event handler binding regardless of the number of rows (so performance is better), it works even when you add rows dynamically, and it doesn't matter if tablesorting does something with the rows. Quick code example follows (remove a table row when clicked): HTML: foo bar foo bar foo bar Javascript (place in $(document).ready(function() { ... } ); ) $('#myTable tbody').bind('click',function(e) { var clicked_row = $(e.target).parent(); // Get the parent, since e.target points to the td-element clicked_row.remove(); });
[jQuery] Re: Tablesorter and event handlers on table rows
Hi, I'm having essentially the same issue and have been tearing my hair out about it for a while now. Do you think you could elaborate on your workaround? At this point I've sort of lost all principles concerning awful hacks and just want to get this implemented. Thanks, Nat On Nov 8, 8:20 am, Raymond78 <[EMAIL PROTECTED]> wrote: > Hi, > > First, a big thanks for creating this great plugin! Very nice. > > I am using TableSorter 2.0 on a table which contains rows on which I > have added some event handlers (using jquery; the events have nothing > to do with sorting, they're for highlighting and processing clicks). > > These event handlers work fine, until I click on a column heading to > sort the table. The sorting works fine, but the event handlers don't > work anymore. After having a look at the sourcecode, it seems to me > that TableSorter effectively removes any event handlers because of the > way it sorts the table. I studied all documentation and examples, but > I couldn't find anything to do this. (There is something to trigger > sorting, but that is the other way around.) > > My question is, is this correct, or am I overlooking something here? > Is there is any way to preserve the row event handlers? > > For now, I have created a small workaround by passing an extra > parameter that contains a function call, which is called after the > sorting is finished; but if there is already a way to do this I'd like > to know. > > I hope someone can help me out. Thanks in advance. > > Kind regards, > > Raymond