Editor autoComplete field cannot be disabled

Editor autoComplete field cannot be disabled

wblakencwblakenc Posts: 78Questions: 17Answers: 1

Link to test case: http://live.datatables.net/mudejitu/1/edit
Debugger code (debug.datatables.net): N/A
Error messages shown: N/A
Description of problem:

When an editor field is set to the autoComplete type, you cannot disable it. Well, technically, it is disabled (as the autocomplete no longer works) but the field is editable. Check out test case above.

Thanks!

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Thanks for the test case. Are you saying you want autoComplete disabled, or the field to be read-only? If read-only, you can use field().disable(). I got a bit lost there.

    Colin

  • wblakencwblakenc Posts: 78Questions: 17Answers: 1

    Thanks Colin. As you can see from the test case, the field is disabled:

    Which prevents the autocomplete from working, but does not prevent the user from entering in text in the field as seen here:

    I would assume that disabling an autoComplete field type, it would essentially become read only, which is not the case.

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    Ah, I see, you need to add the code to disable the element too - the current option only disables the autocomplete functionality, if you add this to the code it does the trick (you'll also need the opposite in the enable section):

          conf._input.prop( 'disabled', true );
    

    See updated example here: http://live.datatables.net/mudejitu/3/edit

    Colin

  • wblakencwblakenc Posts: 78Questions: 17Answers: 1

    Genius! Thank you Colin.

This discussion has been closed.