ExtJS combo 从数据库抽取数据动态绑定下拉菜单及获取值

var addformEData = new Ext.form.FormPanel({
        xtype: "form",
        labelWidth: 100, // label settings here cascade unless overridden
        //url: '../Apis/Treatment.aspx?sid=' + Sys.sid,
        frame: true,
        //title: 'Simple Form',
        //bodyStyle: 'padding:5px 5px 0',
        width: 700,
        autoDestroy:true,
        height: 800,
        //waitMsgTarget: true,
        items:[{
        //defaults: { width: 210 },
            columnWidth: .5,
            layout: 'form',
            defaults: { width: 210 },
            autoDestroy: true,
            items: [{
                id:"id",
                xtype: 'textfield',
                fieldLabel: 'ID',
                name: 'id',
                anchor: '95%',
                hidden:true
            },{
                id:"Title",
                xtype: 'textfield',
                fieldLabel: '标题',
                name: 'Title',
                anchor: '95%'
            }, {
                xtype: 'combo',
                fieldLabel: '优先级',
                hiddenName: 'Priority',
                editable: false,
                forceSelection: true,
                //typeAhead: true,
                triggerAction: "all",
                editable: false,
                anchor: '50%',
                store: storeNoicePriority,
                displayField: "Text",
                valueField: "ID"
            },{
                xtype: 'datefield',
                    fieldLabel: '发布日期',
                    name: 'PublishDate',
                    id:'PublishDate',
                    emptyText: new Date().format('Y-m-d'),
                    anchor: '95%',
                    format: 'Y-m-d'
            }, {
                xtype:'htmleditor',
                id:'Content',
                fieldLabel:'内容',
                height:350,
                anchor:'98%',
                name:'Content'
            }]
     }]
});


 


// 优先级状态
var storeNoicePriority = new Ext.data.Store({
    // destroy the store if the grid is destroyed
    autoDestroy: true,
    autoLoad: true,
    // load remote data using HTTP
    url: '../Apis/BaseData.aspx?actionName=GetNoticePriority',


    // specify a XmlReader (coincides with the XML format of the returned data)
    reader: new Ext.data.JsonReader({
        // records will have a 'plant' tag
        record: 'plant',
        // use an Array of field definition objects to implicitly create a Record constructor
        idProperty: 'ID',
        root: 'rows',
        totalProperty: 'results',
        fields: [
                { name: "ID", mapping: "ID" },
                { name: 'Text', mapping: 'Text' },
            ]
    }),


    sortInfo: { field: 'ID', direction: 'ASC' }
});


 


 


取值:var priority = addformEData.find("hiddenName","Priority")[0].getValue()


本文来自: 小胡设计室(http://www.xhsjs.com/),专业代做ASP.NET毕业设计 详细出处参考:http://www.xhsjs.com/NET/ZhiShi/100000771.shtml
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值