Created
December 11, 2012 22:22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ext.onReady(function() { | |
Ext.define('Ubuntu', { | |
extend: 'Ext.data.Model', | |
fields: [{ | |
name: 'release', | |
convert: function(v, rec) { | |
return Ext.String.format('{0} {1} - {2}', | |
rec.raw.adjective, | |
rec.raw.animal, | |
rec.raw.version); | |
} | |
}] | |
}); | |
Ext.create('Ext.panel.Panel', { | |
renderTo: Ext.getBody(), | |
title: 'Ubuntu Releases', | |
width: 300, | |
bodyPadding: 10, | |
layout: 'anchor', | |
draggable: true, | |
style: 'margin: 20px', | |
items: [{ | |
xtype: 'combo', | |
store: Ext.create('Ext.data.Store', { | |
model: 'Ubuntu', | |
proxy: { | |
type: 'ajax', | |
url: '/backend/autocomplete', | |
reader: { | |
type: 'json', | |
root: 'data' | |
} | |
} | |
}), | |
typeAhead: true, | |
displayField: 'release', | |
hideLabel: true, | |
anchor: '100%', | |
minChars: 3, | |
listConfig: { | |
loadingText: 'Searching...', | |
emptyText: 'No matching release found' | |
} | |
}, { | |
xtype: 'component', | |
style: 'margin-top:10px', | |
html: 'Type at least 3 characters to trigger search' | |
}] | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment