syntax for .show/hide with animate set to false

syntax for .show/hide with animate set to false

montoyammontoyam Posts: 568Questions: 136Answers: 5
edited November 2021 in Editor

I am not finding examples of setting the animate to false for .show and .hide and I can't figure out the correct syntax

I am needing it for show/add of all fields: .show()
and also an array of fields: .show(['field1','field2'])

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586
    edited November 2021

    For show(), it's an additional parameter, so something like

    .show(['field1','field2'], false)
    

    Is that not working for you?

    Colin

  • montoyammontoyam Posts: 568Questions: 136Answers: 5
    edited November 2021

    no, it doesn't seem to be working. I don't get any errors in the console, but it just doesn't display the fields. If i take out the ', false' then it works just fine, but with the animate of course.

    RequestHeaderEditor.show(['RequestHeader.ActionID', 'RequestHeader.EffectiveDate', 'RequestHeader.Comment', 'RequestHeader.UserID'], false);
    

    Unfortunately, I cant provide a link to the project since it is on our intranet.

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    It seems to be working as expected here - if you remove the false, you'll see the animation. There is a slight jerk still, if you want that entirely removed, uncomment the $.fx.off = true; line at the top, and that stops all animations at the jQuery level.

    Could you look at that, please, and see if it helps. If it's still not working for you, please can you update my example so that we can see the problem.

    Cheers,

    Colin

  • montoyammontoyam Posts: 568Questions: 136Answers: 5

    So there are two issues I am seeing.

    1). I don't see a way to add false if you are hiding/showing all fields .hide()
    2). I am wanting to hide all, then show a few. It works fine if I leave off animation, but if you hide all, then try to show with animation set to false, the fields don't show:

    http://live.datatables.net/venireju/3/edit

    .hide()
    .show('field',false)

  • colincolin Posts: 15,142Questions: 1Answers: 2,586
    Answer ✓

    Ah, I see, if you pass in undefined for the fields, then that works, something like

    editor.hide(undefined, false);
    

    I've updated the example with that. There is still some twitching with opened, so I moved it into preOpen so the hides happen before the form is visible,

    colin

  • montoyammontoyam Posts: 568Questions: 136Answers: 5

    Awesome. I tried using an empty array and it didn't like that.

    And after changing the 'hide all' to undefined,false, it fixed the issue with .show not working.

    All appears to work great now. thanks


    RequestHeaderEditor.on('preOpen', function (e, node, data, items, type) { RequestHeaderEditor .hide() .show('RequestHeader.ActionID'); $('.DTE_Form_Buttons button:eq(0)').hide(); }); RequestHeaderEditor.field('RequestHeader.ActionID').input().on('change', function (e, d) { if (d === undefined) { // The change was triggered by the end user on update rather than an auto set RequestHeaderEditor.hide(undefined,false); RequestHeaderEditor.show(['RequestHeader.ActionID'], false); var actionID = RequestHeaderEditor.get('RequestHeader.ActionID'); switch (actionID) { case '1': //add RequestHeaderEditor.show(undefined,false); $('.DTE_Form_Buttons button:eq(0)') .text('Next') .show(); break; case '2': //delete RequestHeaderEditor.show(['RequestHeader.ActionID', 'RequestHeader.EffectiveDate', 'RequestHeader.Comment', 'RequestHeader.UserID'], false); $('.DTE_Form_Buttons button:eq(0)') .text('Submit Request') .show(); break; case '3': //update RequestHeaderEditor.show(['RequestHeader.ActionID', 'RequestHeader.EffectiveDate', 'RequestHeader.Comment', 'RequestHeader.UserID'], false); $('.DTE_Form_Buttons button:eq(0)') .text('Next') .show(); break; } console.log("done"); } });
Sign In or Register to comment.