community
cancel
Showing results for 
Search instead for 
Did you mean: 

Dev Space

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

External Source - Listbox HTML GUI SDK

Alteryx Certified Partner
Alteryx Certified Partner

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

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