首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Ajax >

求教Ext 省市县的联动代码或例子,

2012-03-09 
求教Ext 省市县的联动代码或例子,急!!!! - Web 开发 / Ajax求教Ext 省市县的联动代码或例子,急!!!!最近在

求教Ext 省市县的联动代码或例子,急!!!! - Web 开发 / Ajax
求教Ext 省市县的联动代码或例子,急!!!!

最近在做一个项目,里面有用到用户的注册,用户注册中要用到 省、市、县 的联动,

急救!!!!!!



[解决办法]

JScript code
 
{
  layout: "form",
  items: {
    xtype: "combo",
    fieldLabel: "所在省",
    width: 130,
    store: new Ext.data.Store({
      proxy: new Ext.data.HttpProxy({
        url: ""
      }),
      reader: new Ext.data.JsonReader({
        id: "Key",
        root: "data"
      },
      [{
        name: "Key"
      },
      {
        name: "Value"
      }]),
      baseParams: {
        action: "GetProvinces"
      },
      autoLoad: true
    }),
    mode: "local",
    valueField: "Key",
    triggerAction: "all",
    readOnly: true,
    displayField: "Value",
    hiddenName: "ProvinceId",
    name: "ProvinceId",
    listeners: {
      select: function(combo, record, index) {
        win.dealStoreWin.get(0).form.findField("CityId").clearValue();
        win.dealStoreWin.get(0).form.findField("CityId").getStore().load({
          params: {
            args: record.id
          }
        });
      }
    }
  },
  columnWidth: .5
}]
},
{
  layout: "column",
  items: [{
    layout: "form",
    items: {
      xtype: "combo",
      fieldLabel: "所在市",
      width: 130,
      store: new Ext.data.Store({
        proxy: new Ext.data.HttpProxy({
          url: ""
        }),
        reader: new Ext.data.JsonReader({
          id: "Key",
          root: "data"
        },
        [{
          name: "Key"
        },
        {
          name: "Value"
        }]),
        baseParams: {
          action: "GetCitiesByProvince"
        }
      }),
      mode: "local",
      valueField: "Key",
      triggerAction: "all",
      readOnly: true,
      displayField: "Value",
      hiddenName: "CityId",
      name: "CityId",
      listeners: {
        select: function(combo, record, index) {
          win.dealStoreWin.get(0).form.findField("CountyId").clearValue();


          win.dealStoreWin.get(0).form.findField("CountyId").getStore().load({
            params: {
              args: record.id
            }
          });
        }
      }
    },
    columnWidth: .5
  },
  {
    layout: "form",
    items: {
      xtype: "combo",
      fieldLabel: "所在区",
      width: 130,
      store: new Ext.data.Store({
        proxy: new Ext.data.HttpProxy({
          url: ""
        }),
        reader: new Ext.data.JsonReader({
          id: "Key",
          root: "data"
        },
        [{
          name: "Key"
        },
        {
          name: "Value"
        }]),
        baseParams: {
          action: "GetCountyByCity"
        }
      }),
      mode: "local",
      valueField: "Key",
      triggerAction: "all",
      readOnly: true,
      displayField: "Value",
      hiddenName: "CountyId",
      name: "CountyId"
    },
    columnWidth: .5
  }]
}

热点排行