首页 JQuery/JavaScript ExtJS combo 从数据库抽取数据动态绑定下拉菜单及获取值

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

作者:胡同里的砖头 围观群众:1095 更新于:2013-12-19

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()

 

  • 本文标题: ExtJS combo 从数据库抽取数据动态绑定下拉菜单及获取值
  • 文章分类:【JQuery/JavaScript】
  • 非特殊说明,本文版权归【胡同里的砖头】个人博客 所有,转载请注明出处.
留言评论
站点声明:
1、本站【胡同里的砖头】个人博客,借鉴网上一些博客模板,取其各优点模块自行拼装开发,本博客开发纯属个人爱好。
2、所有笔记提供给广大用户交流使用,可转载,可复制,纯个人开发所遇问题锦集记录使用
Copyright © huzlblog.com All Rights Reserved. 备案号:苏ICP备2021056683号-8