Editor form button to show/hide fieldInfo

Editor form button to show/hide fieldInfo

Loren MaxwellLoren Maxwell Posts: 406Questions: 99Answers: 10
edited August 2022 in Editor

I remember seeing an example a few months ago of adding a custom button to an editor form that would toggle the visibility of the fieldInfo for all the fields (i.e., a "Help" button on the form that would show/hide the fieldInfo information).

I meant to bookmark it, but I cannot find it now even though I've been searching through the forums.

Does anyone know offhand where that example is?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Doesn't ring any bells for me I'm afraid. I'd guess that it used fields() to get all of the field names, then loop over that and use field().node() to get the container node for the field and finally manipulate the DOM (probably the display properly) for the field info elements.

    Allan

  • Loren MaxwellLoren Maxwell Posts: 406Questions: 99Answers: 10
    edited August 2022

    Thanks @allen, that might have been how they approach it.

    I was thinking of using jQuery to hide fieldInfo (data-dte-e="msg-info") in the Editor form open event:

    var editor = new $.fn.dataTable.Editor({
        . . .
    }).on( "open", function (e, mode, action) {
        $('[data-dte-e="msg-info"]').hide()
    })
    

    and then add a button on the Editor form to make them visible again as a Help button.

    I haven't programmed it yet, although I think it's simple enough, but I was hoping to see the other example first to see what their approach was.

  • Loren MaxwellLoren Maxwell Posts: 406Questions: 99Answers: 10

    @allen -- just wanted to follow up on this. I thought there was an example with a button to show/hide help on a form, but it was the ctrl-h combination in the example here:
    https://editor.datatables.net/reference/event/open

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Answer ✓

    Ah! Thanks. I'd totally forgotten about that example.

    Allan

Sign In or Register to comment.