Hey all, I’m wondering if someone can point me in the right direction as to how to re-initialize event handlers after clobbering the DOM with jQuery.
The reason I ask is because we’ve run into a use case where we want to sort the rows of a table, but in kind of a weird way. We have a drawer action on each row in an Accounts table, and in each drawer is another table of child objects with dates. We want to sort the Accounts table based on the dates in the drawer tables. So a row which has a drawer with an item that has the date “02-25-2014” would appear before a row which has a drawer with an item that has the date “05-01-2014”. Strange, I know.
- Obviously DOM elements can be moved around with jQuery but it involves recreating the inner HTML of the table component and destroying the events in the component. So I’m wondering if there’s a way to re-initialize the event handlers. If I have to code up a solution that records the event handlers of each row/field prior to moving HTML around, and re-adds the events afterwards, that’s fine. I’m just not sure where to look.