ExtJS

调用后台代码获取数据,并根据选择的数据触发其它组件

var projectDS = new Ext.data.Store({
     	        proxy: new Ext.data.HttpProxy({
     	            url: './netmarkets/jsp/com/chipsea/doc/getProject.jsp',
     	            method: "post"
     	        }),
     	        reader: new Ext.data.JsonReader({    // read json data
     	                    root: "result",
     	                    totalProperty: "totalCount",
                            fields:[{name:"name"},{name:"displayName"}]
     	                })
     });
projectDS.load();
 var projectCombo = new Ext.form.ComboBox({
         fieldLabel:'项目',
         typeAhead: true,
         triggerAction: 'all',
         lazyRender:true,
         mode: 'local',
         store: projectDS,
         valueField:'name',
         displayField:'displayName',
         listeners: {
            'select': function () {
                console.log("select value:" + this.value);
                var taskDS = new Ext.data.Store({
                baseParams:{'projectName':this.value},
     	        proxy: new Ext.data.HttpProxy({
     	            url: './netmarkets/jsp/com/chipsea/doc/getTask.jsp',
     	            method: "post"
     	        }),
     	        reader: new Ext.data.JsonReader({    // read json data
     	                    root: "result",
     	                    totalProperty: "totalCount",
                            fields:[{name:"task"},{name:"displayTask"}]
     	                })
                });
                taskCombo.value = '';
                taskCombo.store = taskDS;
                taskDS.load();
            }
        }
         });
posted @ 2024-09-25 11:08  挪威森林618  阅读(25)  评论(0编辑  收藏  举报