日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ComboBox联动

發布時間:2023/12/1 编程问答 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ComboBox联动 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

? //從webservice中取數據ajax
??????????? Ext.Ajax.request({
??????????????? url: 'WebService.asmx/GetComboxFirst',
??????????????? method: 'POST',
??????????????? //jsonData: { UserName: "" },
??????????????? headers: { 'Content-Type': 'application/json;utf-8' },
??????????????? success: General,
??????????????? failure: On_Error
??????????? });

??????????? function General(result) {
??????????????? var data = Ext.util.JSON.decode(result.responseText);
??????????????? var ds = new Ext.data.Store({
??????????????????? proxy: new Ext.data.MemoryProxy(data.d),
??????????????????? reader: new Ext.data.JsonReader({ fields: [{ name: 'strText', type: 'string' }, { name: 'strValue', type: 'string'}] })
??????????????? });

??????????????? ds.load();
??????????????? var combox1 = new Ext.form.ComboBox({
??????????????????? store: ds,
??????????????????? displayField: 'strText',
??????????????????? valueField: 'strValue',
??????????????????? typeAhead: true,
??????????????????? mode: 'local',
??????????????????? forceSelection: true,
??????????????????? triggerAction: 'all',
??????????????????? emptyText: 'Select a state...',
??????????????????? selectOnFocus: true,
??????????????????? applyTo: 'combox1'
??????????????? });
??????????????? Genercombox2("1", 5);
??????????????? combox1.on('select', function (comboBox) {
??????????????????? //alert(comboBox.getRawValue() + '-' + comboBox.getValue());
??????????????????? Genercombox2("2", comboBox.getValue());
??????????????? });
??????????? };

??????????? function On_Error() {
??????????? };
??????????? //從webservice中取數據ajax

//從webserivce中取通過HttpProxy,因為asp.net數據是放在.d里面的,所以需要重寫JsonReader來取數據.

? bJsonReader = Ext.extend(Ext.data.JsonReader, {
??????????????? read: function (response) {
??????????????????? var json = response.responseText;
??????????????????? //alert(json);
??????????????????? var o = Ext.decode(json);
??????????????????? //alert(o.d);
??????????????????? this.responseText = json;
??????????????????? if (!o) {
??????????????????????? throw { message: 'JsonReader.read: Json object not found' };
??????????????????? }
??????????????????? return this.readRecords(o.d);
??????????????? }
??????????? });
??????????? var dshttpProxy = new Ext.data.Store({
??????????????? proxy: new Ext.data.HttpProxy({
??????????????????? url: "WebService.asmx/GetComboxFirstByParam", method: 'POST', jsonData: { strParam: 10 }
??????????????? }),
??????????????? reader: new bJsonReader({
??????????????????? fields: [{ name: 'strText', type: 'string' }, { name: 'strValue', type: 'string'}]
??????????????? })
??????????? });

??????????? function Genercombox2(strtype, indexvalue) {

??????????????? if (strtype == "1") {
??????????????????? var combox2 = new Ext.form.ComboBox({
??????????????????????? store: dshttpProxy,
??????????????????????? displayField: 'strText',
??????????????????????? autoLoad: false,
??????????????????????? valueField: 'strValue',
??????????????????????? typeAhead: true,
??????????????????????? mode: 'local',
??????????????????????? id: 'gameAreaID',
??????????????????????? forceSelection: true,
??????????????????????? triggerAction: 'all',
??????????????????????? emptyText: 'Select a state...',
??????????????????????? loadingText: 'Please Select',
??????????????????????? anchor: '100%',
??????????????????????? selectOnFocus: true,
??????????????????????? applyTo: 'combox2'
??????????????????? });
??????????????? }
??????????????? if (strtype == "2") {
??????????????????? var parent = Ext.getCmp('gameAreaID');
??????????????????? parent.reset();
??????????????????? //重新獲取數據
??????????????????? dshttpProxy.proxy = new Ext.data.HttpProxy({
??????????????????????? url: "WebService.asmx/GetComboxFirstByParam", method: 'POST', jsonData: { strParam: indexvalue }
??????????????????? });
??????????????????? dshttpProxy.load();
??????????????? }
??????????? }
??????????? //從webserivce中取通過HttpProxy

轉載于:https://www.cnblogs.com/SevenMilk/archive/2011/03/24/1993647.html

總結

以上是生活随笔為你收集整理的ComboBox联动的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。