show() hide() enable() disable()

show() hide() enable() disable()

LapointeLapointe Posts: 430Questions: 81Answers: 4

should have a parameter to set state as show(field,false,false) will hide field...

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    Is this for Editor? There are field().show() and field().enable() methods which can be chained together - e.g.:

    editor.field('myField').show().enable();
    

    Allan

  • LapointeLapointe Posts: 430Questions: 81Answers: 4
    edited January 2021

    Hi @allan

    Sorry it was not the suggestion...

    src code :

    if (bool) 
        editor.field('fld').show()
    else
        editor.field('fld').hide()
    
    // why not allow 
        editor.field('fld').show(false) 
    // or 
        editor.field('fld').visible(bool)
    

    that should allow simple one line code

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Answer ✓

    Ah - a toggle parameter! I'm with you now - thanks. I've just committed that in :-).

    The field().show() method already has a boolean input to control the animation, so the new toggle parameter is the second parameter for the method. This will be in the next major version of Editor.

    Allan

  • LapointeLapointe Posts: 430Questions: 81Answers: 4

    Hi @allan

    Very nice...

    Same approach for enable disable ?

    Can you tell me when we will start alpha testing ?

    Bob

  • LapointeLapointe Posts: 430Questions: 81Answers: 4

    Hi (again)

    Perhaps a global preset for animation when show, hide should be nice....

    If using animation, easy, if not each show / hide need to be set to false at second parameter, and when editor.hide() or editor.show() where to pass second parameter ?

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    Hi Bob,

    Yes, I’ve put a toggle parameter into the field().enable() method as well.

    Regarding the animation, you can use $.fx.off = true; to disable jQuery animations. I think attempting to use a boolean parameter to mean two different things is going to be confusing though.

    ALlan

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    I forgot to say, I will hopefully have a beta for you next week.

    Allan

This discussion has been closed.