Editor bug which causes incompatibility with IE6-8 and meta-fix.
Editor bug which causes incompatibility with IE6-8 and meta-fix.
I've found what I believe is a minor but fix-worthy bug in Editor. It causes an actual problem only in IE8 (maybe earlier), but unlike most IE nightmares, I don't believe this to be a browser bug.
Background:
1) When a user clicks, "Edit", Editor populates an edit form with one row per table column and sets focus necessarily on the first field.
2) My form has non-editable columns. I can't get Editor to simply not display them ( see http://datatables.net/forums/discussion/12195/read-only-columns-displayed-only-in-datatable#Item_5 if you have been able to get this to work).
3) Instead, I use [code]editor.on( "onInitEdit", function () { editor.disable(['array of non-editable column names']) }[/code] to grey out the uneditable columns.
Because Editor focuses on the first form field even if it is disabled, IE8 complains with:
[code]"Message: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus."[/code]
All browsers except IE8 ignore this, though it is technically probably not a good practice. Even if it were, the intent looks to be "focus on an editable control".
I'm not sure if it's practical to loop through the editor rows and select the first one that isn't disabled, but if not maybe a try/catch can be placed around the .focus call.
Workaround:
Put an editable column above all others in Editor's "fields": [] object.
Background:
1) When a user clicks, "Edit", Editor populates an edit form with one row per table column and sets focus necessarily on the first field.
2) My form has non-editable columns. I can't get Editor to simply not display them ( see http://datatables.net/forums/discussion/12195/read-only-columns-displayed-only-in-datatable#Item_5 if you have been able to get this to work).
3) Instead, I use [code]editor.on( "onInitEdit", function () { editor.disable(['array of non-editable column names']) }[/code] to grey out the uneditable columns.
Because Editor focuses on the first form field even if it is disabled, IE8 complains with:
[code]"Message: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus."[/code]
All browsers except IE8 ignore this, though it is technically probably not a good practice. Even if it were, the intent looks to be "focus on an editable control".
I'm not sure if it's practical to loop through the editor rows and select the first one that isn't disabled, but if not maybe a try/catch can be placed around the .focus call.
Workaround:
Put an editable column above all others in Editor's "fields": [] object.
This discussion has been closed.
Replies
Allan
Allan