Jump to content

Respond to the Select User widget


Graham Quince

Recommended Posts

Hi everyone,

@adamw has just shared with me a really cool bit of code our widgets use to listen to the Select User widget:

        'broadcast.selectedUser': function(el, ev, options) {
          /* do something */
          /*
          selected user's UUID: options.model.attr('uuid')
          username: options.model.attr('username')
          display name: options.model.attr('displayname')
          */
        }

Pop the broadcast function in as it's own "entity"

screenshot.png

Enjoy

Link to comment
Share on other sites

  • 2 years later...

The above code works for FrogCode widgets, this code works for the HTML widgetL

<script>
$('div[data-content-uuid="SELECT_USER_WIDGET_CONTENT_UUID"]').on('broadcast.selectedUser',function(el, ev) {
    console.log(ev);
    console.log("user name = "+ev.model.displayname);
    console.log("user uuid = "+ev.model.uuid);
});
</script>

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...