Editor field is read only and clickable, want to not allow it to be clicked/selected

Editor field is read only and clickable, want to not allow it to be clicked/selected

tmillerintaccttmillerintacct Posts: 9Questions: 2Answers: 0

Example:
https://dev.intacctservices.com/tmtest/DTproject/project.html

I have fields set to read only:

            fields: [
        {
            "label": "Project Id",
            "name": "PROJECTID",
            "type": "readonly"
        },

which is in the:

  var editor = new $.fn.dataTable.Editor( {

section of the js file. It is indeed read only, but users click on it and see a text box and only know it is readonly when they can't type anything. So they want to not be able to click on it. I have looked through the forums and do not see anything that applies to the latest version of table editors for this. Has anyone else solved this that they can share what they did?

Answers

  • CT General AssemblyCT General Assembly Posts: 20Questions: 3Answers: 1

    Did you ever resolve this? I have the same issue.

  • allanallan Posts: 63,754Questions: 1Answers: 10,509 Site admin

    Hi,

    Are you looking to have the field hidden? If so, the hidden field type can be used rather than readonly.

    Allan

  • CT General AssemblyCT General Assembly Posts: 20Questions: 3Answers: 1

    I want the field to show, but since it is read-only, when they click, I do not want the input box to appear like they can edit it.

  • CT General AssemblyCT General Assembly Posts: 20Questions: 3Answers: 1
    edited October 2015

    I figured it out.

        editor.on('initEdit', function() {
            editor.show(); //Shows all fields
            editor.disable('field1');
            editor.disable('field2');
        });
    

    This at least makes them look grey so the user knows they cannot type in that field.

  • allanallan Posts: 63,754Questions: 1Answers: 10,509 Site admin

    Thanks for the clarification. Another option is to use the display only plug-in. The text is still selectable like any text on the page, but it is not in an -input element.

    Allan

  • tmillerintaccttmillerintacct Posts: 9Questions: 2Answers: 0

    CT, thanks for the solution. I had not had time to figure it out yet, I will try your solution as well as look into what Allan said, the display plug in.

This discussion has been closed.