I have a scenario where I am creating a combo box using ExtJS 4 within an editable grid, and instead of using an ExtJS proxy, I am making an external AJAX call to populate it. The reason behind this approach is that I am using the same call to load other combo boxes as well, so it made sense to reuse the function. Below is the code for the store, model, dropdown, and AJAX call:
var drpdwnitems = "";
Ext.define('rStatusRecord', {
extend: 'Ext.data.Model',
fields: [
{ name: 'code', type: 'string' },
{ name: 'value', type: 'string' }
]
});
var dsStatus = Ext.create('Ext.data.Store', { model: 'rStatusRecord', data: [] });
var timeSelectField_1 = {
xtype: 'combobox',
typeAhead: true,
displayField: 'code',
valueField: 'value',
store: dsStatus,
triggerAction: 'all'
};
This combo box is used within a grid panel for editing purposes. The AJAX call returns a string.
$.ajax({
type: "GET",
url: "XHR/Task_TypesCalls.aspx?TL_A=1",
error: function() { alert('Error loading document'); },
success: loadAvailableTasksList
});
function loadAvailableTasksList(contents, status) {
drpdwnitems = contents.split("!");
if (status != "success") return;
var drpdwnitemsind;
dsStatus.removeAll();
for (i = 0; i < drpdwnitems.length; i++) {
drpdwnitemsind = drpdwnitems[i].split(":");
statusRecord = Ext.create('rStatusRecord', {
code: drpdwnitemsind[0], //"",
value: drpdwnitemsind[0]//""
});
dsStatus.add(statusRecord);
} //end of loop
}
However, when I edit the field and open the combo box, I encounter an error
TypeError: url is undefined
This error is in the file ext-all-debug.js
My guess is that the url configuration of the store is required and I might not be providing it. Or there could be something else wrong in my implementation?