当前位置: 代码迷 >> Web前端 >> Ext combox从后盾取值
  详细解决方案

Ext combox从后盾取值

热度:133   发布时间:2012-09-11 10:49:03.0
Ext combox从后台取值

js:

程序代码

var RecordDef = Ext.data.Record.create([
??????? {name: 'id'},{name: 'name'}??????????????
??? ]);
??? var cityStore = new Ext.data.Store({
??????????? proxy:new Ext.data.HttpProxy({url:'comboxdata.php'}),
??????????? reader:new Ext.data.JsonReader({id:"id",totalProperty:"restults",root:"row"},RecordDef),
??????????? listeners :{load : function(){}},
??????????? remoteStore:true
???? });
???? cityStore.load();
???? var combo = new Ext.form.ComboBox({
???????? store:cityStore,
??????? emptyText:'Select a name...',
??????? loadingText:'loading',
??????? selectOnFocus:true,
??????? displayField:'name',
??????? mode:'remote',
??????? triggerAction:'all',
??????? applyTo: 'local-states'
??? });



后台返回:

程序代码


{'results':3,'row': [{'id':1,'name':'Peking'},{'id':2,'name':'shanghai'},{'id':3,'name':'shenyang'}]}

来自: http://chenxueyong.iteye.com/blog/325227