I am working on Extjs 4.1. I did implement an autocomplete feature for the text box.I would like to customize the displayfield to display multiple values instead of one. I tried convert function:
Ext.define("Post", {
extend: 'Ext.data.Model',
proxy: {
type: 'ajax',
url: 'app/search/autocomplete.php',
reader: {
type: 'json',
root: 'names',
autoLoad: true,
totalProperty: 'totalCount'
},
fields: ['f_name','l_name', {
name : 'display',
convert : function(v, rec) {
return rec.f_name + ' ' + rec.l_name
}
}]
});
but I got: undefined undefined in the text box!
You need to grab the property:
return rec.get('f_name') + ' ' + rec.get('l_name');