此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
楼主【w5325698】截止到2008-08-02 19:00:34的历史汇总数据(不包括此帖):
发帖的总数量:12                       发帖的总分数:170                      每贴平均分数:14                       
回帖的总数量:78                       得分贴总数量:21                       回帖的得分率:26%                      
结贴的总数量:11                       结贴的总分数:120                      
无满意结贴数:2                        无满意结贴分:100                      
未结的帖子数:1                        未结的总分数:50                       
结贴的百分比:91.67 %               结分的百分比:70.59 %                  
无满意结贴率:18.18 %               无满意结分率:83.33 %                  
值得尊敬

取消马甲机器人,请点这里:http://www.java2000.net/mycsdn/robotStop.jsp?usern=w5325698

解决方案 »

  1.   

    var 引用 = new 窗口实例({
        ......
    })var 引用  定义成全局变量试试看
      

  2.   

    LZ不好意思我以为你的是Windos窗体不如你把代码贴出来看看
      

  3.   

    最近也在研究EXT 
    关注!
      

  4.   

    我在使用ajax+ext时 有时候也会出现反应迟缓。再点一次可能就反应了。但是没看到你的代码。不好做评述。
      

  5.   

    var data=[
    ['1','1','1','1','1','1'],
    ['2','2','2','2','2','2'],
    ['3','3','3','3','3','3'],
    ['4','4','4','4','4','4'],
    ['5','5','5','5','5','5'],
    ['6','6','6','6','6','6'],
    ['7','7','7','7','7','7'],
    ['8','8','8','8','8','8'],
    ['9','9','9','9','9','9'],
    ['2','2','2','2','2','2'],
    ['3','3','3','3','3','3']
    ];
    var ds=new Ext.data.Store({
         proxy:new  Ext.data.MemoryProxy(data),
         reader:new Ext.data.ArrayReader({},[
         {name:'wareid'},
         {name:'warename'},
         {name:'SearchWord'},
         {name:'type'},
         {name:'description'},
         {name:'waregrounp'},
         {name:'re'}
         ]),
         scope:this
        });
        ds.load();
        var cm=new Ext.grid.ColumnModel([
         {id:'商品编号', header: "商品编号", width: 200,editor:new Ext.grid.GridEditor(new Ext.form.TextField({
         allowBlank:false,
         blankText:"商品编号不能空"
         })) ,sortable: true, dataIndex:'wareid',scope:this},
            {header: "商品名称", width: 120, sortable: true,editor:new Ext.grid.GridEditor(new Ext.form.TextField({
             allowBlank:false,
             blankText:'商品名称不能为空'
            })),dataIndex: 'warename',scope:this},
            {header: "时间", width: 120, sortable: true,editor:new Ext.grid.GridEditor(new Ext.form.DateField({
             format:"y/m/d"
            })) ,dataIndex: 'SearchWord',scope:this},
            {header: "类型", width: 120, sortable: true,editor:new Ext.grid.GridEditor(new Ext.form.TextField({
             allowBlank:false,
             blankText:"类型不能为空"
            })) ,dataIndex: 'type',scope:this},
            {header: "描述信息", width: 135, sortable: true,editor:new Ext.grid.GridEditor(new Ext.form.TextField({
             allowBlank:false,
             blankText:"描述信息不能为空"
            })) ,dataIndex: 'description',scope:this},
            {header:"所在组",width:120,sortable:true,editor:new Ext.grid.GridEditor(new Ext.form.TextField({
             allowBlank:false,
             blankText:"组名不能为空"
            })),dataIndex:'waregrounp',scope:this},
            {header:"备注",width:120,sortable:true,editor:new Ext.grid.GridEditor(new Ext.form.TextField({
            })),dataIndex:'re',scope:this}
        ]);
    var ware = new Ext.grid.EditorGridPanel({
    id:'ware',
        ds:ds,
        cm:cm,
        enableDrag:true,
        enableDrog:true,
        viewConfig: {
            forceFit: true
        },
        sm: new Ext.grid.RowSelectionModel({singleSelect:false}),
        tbar:new Ext.Toolbar(["-",{
         text:"添加",
         icon:'add',
         handler:function(){
         var initValue={
    wareid:'',
    warename:'',
    SearchWord:'',
    type:'',
    description:'',
    waregrounp:'',
    re:''
    };
    var newline=new Ext.data.Record(initValue);
    ware.stopEditing();
    ds.insert(0,newline);
    ware.startEditing(0,0);

    newline.dirty=true;
    newline.modified=initValue;
    if(ds.modified.indexOf(newline)==-1){
    ds.modified.push(newline);
    }
         }
        },"-",{
         text:"删除",
         handler:function(){
         Ext.Msg.confirm('消息','确定删除吗?',function(btn){
         if(btn=='yes'){
         ds.remove(ware.getSelectionModel().getSelected());
         }
         });
         },
         icon:'delete'
        },"-",{
        text:"保存",
        iconCls:'',
        handler:function(){
        var m=ds.modified.slice(0);
        for(var i=0;i<m.length;i++){
        var record=m[i];
        var fields=record.fields.keys;
       
        for(var j=0;j<fields.length;j++){
        var name=fields[j];
        var value=record.data[name];
       
        var colIndex=cm.findColumnIndex(name);
        var rowIndex=ds.indexOfId(record.id);
        var editor=cm.getCellEditor(colIndex).field;
        if(!editor.validateValue(value)){
        Ext.Msg.alter('提示','请确保输入的数据正确',function(){
        ware.startEditing(rowIndex,colIndex);
        });
        return;
        }
        }
        }
        var jsonArray=[];
        Ext.each(m,function(item){
        jsonArray.push(item.data);
        });
        Ext.lib.Ajax.request(
        'post',
        'Dowaredata',
        {success:function(response){
        Ext.Msg.alter(response.responseText,function(){ds.reload();
        });
        }},{failure:function(){
        }}
        );
        }
        }]),
        width:600,
        height:310,
        frame:true,
        title:'商品表',
        iconCls:'icon-grid',
        bbar:new Ext.PagingToolbar({
         pageSize:10,
         store:ds,
         displayInfo:true,
         displayMsg:'第{0}条到{1}条共有{2}条',
         emptyMsg:'no data'
       }),
        scope:this
    });
      

  6.   

    var window=new Ext.Window({
    width:600,
    height:350,
    resizable:false,
    items:[ware],
    scope:this
    });
    window.addButton({
    text:'退出',
    id:'exit',
    handler:function(){
    window.close();
    }
    });
      

  7.   

    我解决了。。高兴。
    把列模型放到 new Ext.grid.EditorGridPanel({
    })里面。
    也就是
    new Ext.grid.EditorGridPanel({
        .....
        cm:new Ext.grid.ColumnModel([
            ......
        }),
        .....
    });因为要是可编辑的GridPanel每次生成的可编辑字段不一样。