0
votes

I have an ExtJS picker that will have dynamic data. I make an AJAX call to get the data, create the picker, call setData, then show the picker.

However, the picker is not rendering the data. If I call picker.getData(), it returns the data object passed in when calling setData. I believe I need to refresh/update the underlying dataview in the picker but not sure how.

EDIT: I am using ExtJS 6.2.0 MODERN and there is no TypeAhead component available. So I am trying to create one using a textfield and a picker. On change of the textfield I will pass the query to the server and get the filtered results back. I then want to set that data to the picker.

Fiddle

1
Why would you try and set the data after? Also the data doesn't match what is expected. fiddle.sencha.com/#view/editor&fiddle/2rvs - Evan Trimboli
I am using 6.2.0 Modern and trying to create a typeahead using a textfield and a picker component. - stackato

1 Answers

0
votes

Your can set the data in the configuration for the picker. Here is an updated success method that should work.

success: response => {
    const picker = Ext.create('Ext.Picker', {
        slots: [{
            data: Ext.JSON.decode(response.responseText)
        }]
    });

    Ext.Viewport.add(picker);
    picker.show();
}