Close drawer with button

  • 1
  • Question
  • Updated 1 year ago
  • Answered
Has Skuid or TFG come up with a component that adds "close drawer" action for a button?
Photo of Bill Fox

Bill Fox

  • 7,954 Points 5k badge 2x thumb

Posted 2 years ago

  • 1
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Hi Bill -

Can you provide more details on your use case and what you would like to see?  What type of button and inside of which component?  Which drawer would it close?

The TFG collapsible wrapper has API methods that let you expand/collapse all wrappers.  The functionality is also exposed by publishing events (see the CW videos for more info).  I don't think this would meet your use case but just in case, wanted to make sure you are aware.
Photo of Bill Fox

Bill Fox

  • 7,954 Points 5k badge 2x thumb
Thanks Barry.  It is easiest to show a video.
https://drive.google.com/file/d/0B409lhd9sYDcalpFRk5tb2pzUms/view
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Glad that worked Bill.  Not sure why you would have to remove $ or change toggle to close but at least you got it working :)
Photo of David Forder

David Forder

  • 2,144 Points 2k badge 2x thumb
Hi Barry.. the sample page wouldnt open for me but I thought I pulled the js out of the page above ok.

Still no joy.

Can you see anything wrong with this 
(function(skuid){	
    var $ = skuid.$;    
    
    skuid.snippet.registerSnippet('closeDrawerFromInsideDrawer', function(args) {              
        var eventArg = arguments[0]
        , context = eventArg.context
        , editor = (context && context.editor) || eventArg.editor
        , element = editor && editor.element;
        
    $(element).closest('.sk-drawer').data('component').toggle();
    });    
    
})(skuid)


to close a drawer with a button within it?
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Hi David -

I just tested the sample page from above and it worked properly for me using version 10.0.3 of Skuid.

Questions:
1) When you say "it wouldn't open", what do you mean?  Are you getting errors and if so, what?
2) What version of Skuid are you using?
3) In the JS that you extracted, what errors are you getting when you try to use it on your own page?
4) In your test page where you extracted the javascript, what is the "Resource Location" you have set on this - Inline, Inline (Snippet), etc.?  You should ensure it's set to "Inline"
4) Can you include your entire page XML on your test page please?
Photo of David Forder

David Forder

  • 2,144 Points 2k badge 2x thumb
Hmm.. I must have had a brain fart. Just tried it again and it did render fine. Sorry about that!

I swear I got errors yesterday lol
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
No worries, possibly a copy/paste issue.  Glad it's working for you!