Editor bug which causes incompatibility with IE6-8 and meta-fix.

Editor bug which causes incompatibility with IE6-8 and meta-fix.

burncharburnchar Posts: 118Questions: 12Answers: 0
edited October 2012 in Editor
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.

Replies

  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    Excellent point - thank you for posting this. I'll make sure a proper fix goes into 1.2.2.

    Allan
  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    Fix now committed and will be in 1.2.2 which should be out fairly soon. The focus is now given to the first enabled and visible input, select or textarea control in the form.

    Allan
This discussion has been closed.