Ext JS4 comboBox读取数据库

Ext.onReady(function() {

	// create model
	Ext.define('info', {
		extend: 'Ext.data.Model',
		fields: [{
			name: 'id',
			type: 'int'
		}, {
			name: 'name',
			type: 'string'
		}, {
			name: 'password',
			type: 'string'
		}]
	});
	
	
	// the data store containg the list of states
	var states = Ext.create('Ext.data.Store', {
		model: 'info',
     	proxy: {
			type: 'ajax',
         	url: 'http://localhost/videocall/temp/jstest/data.php',
         	reader: {
   				type: 'json',
   				root: 'rows'
			}
     	},
     	autoLoad: true
	});
	
	// create the combo box, attached to the states data store
	Ext.create('Ext.form.ComboBox', {
		fieldLabel: 'Choose State', 
		store: states,
		emptyText: 'choose',
		queryMode: 'local',
		displayField: 'name',
		valueField: 'id',
		renderTo: Ext.getBody()
	})
});
Ext JS4 comboBox读取数据库_第1张图片

你可能感兴趣的:(Ext JS4 comboBox读取数据库)