我刚开始用ext,FormPanel
现在的问题是,我在页面中用了一个FormPanel,editgridPanel,把editgridPanel放在了FormPanel中,
然后,grid就是我的一张报表,第一列和第二/三/四列都是固定的值,不用存到数据库中,只有后7列保存。
一共28行数据,这样的一张报表,如何做到提交的时候校验哪个单元格的数据是否对,还有一张表的数据用Json方式如何传到后台Action中,若修改并返回填写到grid中呢?已经研究好几天了没进展,睡觉都做梦写程序,苦啊!请各位大侠指点一下吧!
1。校验
2,用Json方式提交数据
大概这两个问题吧,也不知道我说明白没有拉!

解决方案 »

  1.   

    1.你要定义store
    2.有editorgrid
    //这里就写提交操作:{ text: "保存", icon: "", handler: function() {
                if(win.get(1).get(0).form.findField("Name").getValue()==""){
                    Ext.Msg.show({ title: "提示", msg: "", width: 400, fn: function(btn) { }, buttons: Ext.MessageBox.OK, icon: Ext.MessageBox.INFO });                
                    return;
                }
                var arr = [];
                for (var i = 0; i < store.getCount(); i++) {
                    arr.push(store.getAt(i).data);//这里将所有数据源提交到后台
                }
                alert(Ext.encode(arr))//alert一下看看。
                Ext.Ajax.request({ url: "",
                    params: Ext.apply({ action: "", dataItems: Ext.encode(arr) }, form.form.getValues()),
                    method: "POST",
                    success: function(response, opts) {
                        var o = Ext.decode(response.responseText);
                        if (o.success) {
                            
                        } else {
                            Ext.Msg.show({ title: "提示", msg: o.message, width: 400, icon: Ext.MessageBox.INFO, buttons: Ext.MessageBox.OK });
                        }
                    },
                    failure: function(response, opts) {
                    }
                });
            }
            }