Re-Binding jEditable on Grid Change
Re-Binding jEditable on Grid Change
I'm using the jEditable plug-in, and when I sort, page, or search and new rows show up in my grid, the new row cells are not editable.
In the example page demonstrating the use of jEditable with DataTables (http://datatables.net/examples/api/editable.html), there isn't this problem because in this example, a full HTML table is rendered and then DataTables laid on top of it. When you e.g. move to the next page and new rows are loaded into the table, the new rows and cells are editable.
In my example, I'm loading data into the grid using a JavaScript array (demonstrated here: http://datatables.net/examples/data_sources/js_array.html), and then laying jEditable onto the table after I've initialized DataTables.
To solve this, I'm using the fnDrawCallback setting and pointing it to a function that re-binds jEditable to the table cells on every draw. This works, but seems like overkill, and I'm just wondering if there's a slicker way to do this. Is it possible to use jQuery live somehow?
Thanks!
In the example page demonstrating the use of jEditable with DataTables (http://datatables.net/examples/api/editable.html), there isn't this problem because in this example, a full HTML table is rendered and then DataTables laid on top of it. When you e.g. move to the next page and new rows are loaded into the table, the new rows and cells are editable.
In my example, I'm loading data into the grid using a JavaScript array (demonstrated here: http://datatables.net/examples/data_sources/js_array.html), and then laying jEditable onto the table after I've initialized DataTables.
To solve this, I'm using the fnDrawCallback setting and pointing it to a function that re-binds jEditable to the table cells on every draw. This works, but seems like overkill, and I'm just wondering if there's a slicker way to do this. Is it possible to use jQuery live somehow?
Thanks!
This discussion has been closed.
Replies