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

来源:互联网 发布:如何开通淘宝旺铺 编辑:程序博客网 时间:2024/05/16 06:21
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
原创粉丝点击