Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Dev Space

Customize and extend the power of Alteryx with SDKs, APIs, custom tools, and more.

External Source - Listbox HTML GUI SDK

BenMoss
ACE Emeritus
ACE Emeritus

Second question from me today.

 

I've previously created a HTML GUI tool which populates a dropdown using the meta-info from the macro input, and i've succesfully transferred this logic to work for a listbox; however, in this sitatuation, we want to use the option to get the data from an external source.

 

Could anyone advise on how I could look to do this?

 

At present my HTML  for the listbox selector looks like...

 

      <section>
          <h2>XMSG("Select the field containing your task content")</h2>
        <ayx data-ui-props='{type:"ListBox", widgetId:"TaskContent", searchable: true}' data-item-props='{dataName:"TaskContent", dataType:"FieldSelectorMulti"}'></ayx>
      </section>

My understanding is that it's the data-item-props that forces the widget to pull data from the meta-info, but I'm not sure how I can amend this to work with an external source.

 

Ben

2 REPLIES 2
jdunkerley79
ACE Emeritus
ACE Emeritus

We're going deep today @BenMoss

 

So clearly this help is conditional on you not winning the SNES :)

 

You need to create the data item in JavaScript and its got some warts...

 

In the HTML do:

<ayx data-ui-props='{type:"ListBox", widgetId:"TaskContent", searchable: true}'></ayx>

Then within Alteryx.Gui.AfterLoad, do something like:

 

 
Alteryx.Gui.AfterLoad = function(manager, AlteryxDataItems) {
# ...
var fsm = new AlteryxDataItems.FieldSelectorMulti("TaskContent", { manager: manager } )
fsm.forceFieldInFieldList({strName: "James", strType: "Int16"})
manager.addDataItem(fsm)
manager.bindDataItemToWidget(fsm, "TaskContent")
#...
}

 

It does seem to add missing but isnt far off what you need

You will need to amend the forceField bit to what you need

 

Good luck

J

 

SeanAdams
17 - Castor
17 - Castor

MAN - I am in awe of you two - lots of catching up for me to do.