Hello, i'm developing a widget on experience builder 1.14 that uses the AdvancedSelect component from jimu-ui, is there any way to listen to the search input change event to trigger an api call for fetching data ?
I'm actually using the staticValues property to provide the options for my advancedSelect , how can I use the datasource property instead ?
Solved! Go to Solution.
a few versions back it was not possible with the componenet AdvancedSelect ... I believe it is still the same in version 1.14.
We kind of hacked the simple component Select to provide the functionality you described. See the sample below
a few versions back it was not possible with the componenet AdvancedSelect ... I believe it is still the same in version 1.14.
We kind of hacked the simple component Select to provide the functionality you described. See the sample below
thank you for your reply, it was very helpful
Hi @WalaZargouni, if you're interested, there is a dynamic demo on storybook https://developers.arcgis.com/experience-builder/storybook/?path=/story/components-jimu-ui-index-adv... and please refer to the following codes:
const field = {
name: 'objectid',
alias: 'objectid',
jimuName: 'objectid',
esriType: EsriFieldType.OID,
type: JimuFieldType.Number
}
const imField = Immutable(field) as IMFieldSchema
const DynamicTemplate: Story<AdvancedSelectProps> = args => {
const [selectedValues, SetSelectedValues] = React.useState([])
const { staticValues, ...otherArgs } = args // no staticValues for dynamic case
const onChange = (value) => {
SetSelectedValues(value)
}
return <AdvancedSelect {...otherArgs as any} dataSource={ds} selectedValues={selectedValues} onChange={onChange} > </AdvancedSelect>
}
export const DynamicData = DynamicTemplate.bind({})
DynamicData.args = {
field: imField
}