meihua212 2009-03-11 08:33
浏览 314
已采纳

如何EditorGridPanel数据获取

Ext.onReady(function(){
    
    
    var cm = new Ext.grid.ColumnModel([{
        header:"id",
        dataIndex:"id"
    },{
        header:"姓名",
        dataIndex:"name"
    //editor:new Ext.form.TextField()
    },{
        header:"业务室",
        dataIndex:"department"
    //editor:new Ext.form.TextField()
    },{
        header:"上午",
        dataIndex:"morning",
        editor:new Ext.form.TextField()
    },{
        header:"下午",
        dataIndex:"afternoon",
        editor: new Ext.form.ComboBox({
                                    fieldLabel : '性别',
                                    hiddenName : 'gender',
                                    store : new Ext.data.SimpleStore({
                                                fields : ['abbr', 'state'],
                                                data : [['换休', '换休'],
                                                        ['事假', '事假'],
                                                        ['出差', '出差'],
                                                        ['探亲假','探亲假']]
                                            }),          
                                    valueField : 'abbr',
                                    displayField : 'state',
                                    typeAhead : true,
                                    mode : 'local',
                                    triggerAction : 'all',
                                    emptyText : '请选择性别',
                                    forceSelection : true,
                                    selectOnFocus : true,
                                    editable : false
                                })
    },{
        header:"备注",
        dataIndex:"note",
        editor:new Ext.form.TextField()
    },{
        header:"日期",
        dataIndex:"datenote",
        renderer:Ext.util.Format.dateRenderer('Y年m月d日'),   
        editor:new Ext.form.DateField({format:'Y年m月d日'})

    }]);
    var fields = ["id","name","department","morning","afternoon","note","datenote",{name:"datenote",type:"date",dateFormat:"Y-n-j"}];
    var data = [
        ["1","张三","计算机","正常","正常","无","2008-08-08"],
        ["2","张三"","计算机","正常","正常","无","2008-08-08"],
        ["3","张三","计算机","正常","正常","无","2008-08-08"],
        ["4","张三","计算机","正常","正常","无","2008-08-08"],
        ["5","张三","计算机","正常","正常","无","2008-08-08"]];
    
    var store = new Ext.data.SimpleStore({
        fields:fields,
        data:data
    

    
    });
    

    var grid = new Ext.grid.EditorGridPanel({
        title:"考勤",
        width:720,
        height:200,
        cm:cm,
        store:store,
                tbar : [{
                    text : '保存',
                    tooltip : '保存考勤信息',
                    iconCls : 'add',
                    handler:this.onSaveButtonClick,    
                    scope:this  
                    
                    
                }]
        
    });
    grid.render(Ext.getBody());
});

 初学EXtjs,我想把EditorGridPanel中信息一次存到数据库中怎么做呢?怎么能一次获得表中所有数据?不知道我说清楚没?

展开全部

  • 写回答

1条回答 默认 最新

  • 马勒格彼得 2009-03-11 09:20
    关注

    哥们,不需要一次获得,你每次操作完以后会有个COMMIT提交到后台的,一次提交是不现实的,不过你实在想弄的话,我可以跟你说,你可以这样,写个方法逐个添加
    function uploadAll(){
    grid.stopEditing();// 停止编辑
    if(store!=null){
    for(i=0;i<store.getCount();i++){
    var record=store.getAt(i);
    Ext.Ajax.request({
    url:'保存数据的方法',params:{参数1:record.get('值1'),参数n:record.get('值n')},method:'post',
    success:function(response,options){//提交成功},
    failure:function(response,options){}

    });
    }
    }
    }

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

悬赏问题

  • ¥15 python排课代码读写xlsx表格出现bug
  • ¥15 KeiI中头文件找不到怎么解决
  • ¥15 QT6将音频采样数据转PCM
  • ¥15 本地安装org.Hs.eg.dby一直这样的图片报错如何解决?
  • ¥15 下面三个文件分别是OFDM波形的数据,我的思路公式和我写的成像算法代码,有没有人能帮我改一改,如何解决?
  • ¥15 Ubuntu打开gazebo模型调不出来,如何解决?
  • ¥100 有chang请一位会arm和dsp的朋友解读一个工程
  • ¥50 求代做一个阿里云百炼的小实验
  • ¥15 查询优化:A表100000行,B表2000 行,内存页大小只有20页,运行时3页,设计两个表等值连接的最简单的算法
  • ¥15 led数码显示控制(标签-流程图)