Open manikantareddygk opened 10 years ago
I noticed this as well. However, calling ".editableTableWidget()" on the table again will take care of it. Though I wonder if it would be beneficial to have a standard reload/refresh method to handle this.
thanks @Nullity42 works great.. but you are right there should be some standard way to do it...
:+1: :wink:
:+1:
O
I noticed this as well. However, calling ".editableTableWidget()" on the table again will take care of it.
Yes but it will bind the events twice :( This bug really needs a proper fix and not a workaround.
Works for me if I add the tds with tabindex=1 set. e.g.
$('#tbl tr:last').after('<tr><td tabindex=1>0</td><td tabindex=1>stuff</td></tr>');
(and only calling .editableTableWidget one time)
I tried bcheck's solution, but it still added multiple listeners to existing tds.
To prevent this I use a custom init function rosterEdit:
$('#mainTable').editableTableWidget().rosterEdit()
Insert an unbind() before any listeners are added to remove existing events:
element.find('td').unbind().on('change', function (evt) {}).on('validate', function (evt, value) {});
View the source on http://mindmup.github.io/editable-table/ to see an example of how to use the custom init function.
FWIW - I'd use .on selectors instead of directly binding the tds in validations, e.g.:
$('#mainTable')
.editableTableWidget()
.on('validate', 'tbody td', function(evt, newValue) {
return false; // mark cell as invalid
});
Include "tabindex=1" when adding rows as suggested before:
$('#mainTable tbody tr:last').after('<tr><td tabindex=1>0</td><td tabindex=1>stuff</td></tr>');
And do nothing else. editableTableWidget() doesn't bind the tds itself, that's your custom validations; editableTableWidget() binds at the table level same as I'm suggesting above.
working excellent on table row, predefined but editing is not working on rows added,dynamically if there is any snippet please let me know