[Plugin: WP-Table Reloaded] how to add row click support
-
thought this might help someone. was really stymied as to how to detect a user clicking on a row. i’m sure there’s a jquery way but i still can’t get through how to add handlers/plug-ins since the wp plug-in does the ‘ready’ function and there’s only that custom parameters deal, but anyway, i digress.
using the (thank you!) sample wordpress plugin to extend wp-table reloaded, i did the following in wp-table-reloaded-extensions.php:
function wp_table_reloaded_hack_row( $row_class, $table_id, $row_idx ) { // row class will normally be output like this: // $row_class = " class=\"{$row_class}\""; // if we insert js in the middle, it might work... // $row_class = " class=\"{old $row_class appeneded with \" onclick="alert('foo')\"'; // $row_class .= ' \" onclick="alert(\'foo\')'; $row_class .= "\" onclick=\"window.location = '/your-link-here'"; return $row_class; } add_filter( 'wp_table_reloaded_row_css_class', 'wp_table_reloaded_hack_row', 10, 3);
it ‘cheats’ by adding the event handler in the row string when adding css classes. ??
- The topic ‘[Plugin: WP-Table Reloaded] how to add row click support’ is closed to new replies.