KeyTable event cache vs jQuery bind & trigger
KeyTable event cache vs jQuery bind & trigger
I was a little surprised to see KeyTable has some alternative event binding scheme; I'd hoped to change some lines that look like
[code]$('td.name').live('click', fnFoo)[/code]
to
[code]$('td.name').live('click action', fnFoo)[/code]
and be on my merry way. And I see that I *could* add a keytable event handler with something like
[code]
keys.event.action(null, null, function (nCell) {
$(nCell).trigger('action');
}
[/code]
to get that behaviour, but I was wondering why you had the plugin keep its own event cache instead.
I guess if you did want to address cells by row/column index, you probably can't do that very easily with the core jQuery selectors.
[code]$('td.name').live('click', fnFoo)[/code]
to
[code]$('td.name').live('click action', fnFoo)[/code]
and be on my merry way. And I see that I *could* add a keytable event handler with something like
[code]
keys.event.action(null, null, function (nCell) {
$(nCell).trigger('action');
}
[/code]
to get that behaviour, but I was wondering why you had the plugin keep its own event cache instead.
I guess if you did want to address cells by row/column index, you probably can't do that very easily with the core jQuery selectors.
This discussion has been closed.
Replies
To be perfectly honest, the main reason that it is not done that way is that I didn't know about custom events in jQuery :-). I'd fully agree that this is something that should be looked at for the next major revision of KeyTable! Thanks for bringing it up!
Regards,
Allan