- 浏览: 44703 次
- 性别:
- 来自: 河北
最新评论
前台ext页面
PersonRegistration = Ext.extend(Ext.Panel,{
personRegistrationForm:null,
personRegistrationGridPanel:null,
constructor:function() {
this.personRegistrationForm = new PersonRegistrationForm();
this.personRegistrationGridPanel = new PersonRegistrationGridPanel();
PersonRegistration.superclass.constructor.call(this,{
renderTo:"getLineCode",
autoWidth:true,
items:[this.personRegistrationForm,this.personRegistrationGridPanel]
});
}
});
/*****************************************************/
PersonRegistrationForm = Ext.extend(Ext.form.FormPanel,{
constructor:function() {
PersonRegistrationForm.superclass.constructor.call(this,{
id:"lineCodeForm",
height:100,
frame:true,
defaultType:"textfield",
buttonAlign:"left",
standarSubmit:true,
items:[{
name:"taxpayid",
allowBlank:false,
fieldLabel:"计算机代码"
}],
buttons:[
{
text:"保存",
handler:function() {
var storeValue = Ext.getCmp("personRegistrationGrid").getStore();
//var m = storeValue.getModifiedRecords();
var jsonarray=[];
//Ext.each(m,function(item){jsonArray.push(item.data);});
storeValue.each(function(item){
//jsonarray.push(item.get("documentsid")+","+item.get("linecode"));
jsonarray.push(item.data);
});
var result = Ext.encode(jsonarray);
/*var lineCodeForm = Ext.getCmp("lineCodeForm");
var count = storeValue.getCount();
var _rd = 0;
lineCodeForm.form.loadRecord(storeValue.getAt(0));*/
Ext.getCmp("lineCodeForm").form.submit({
url:"http://139.28.96.10:8080/scan/secure/taxcase",
method:"POST",
params:{
result:result
},
waitTitle:"提交数据",
waitMsg:"正在提交,请稍后",
success:function(form,action) {
//alert(action.result.success);
Ext.Msg.alert("提示信息","提交成功");
//Ext.getCmp("savedGrid").getStore().reload();
//Ext.getCmp("savedGrid").getView().refresh();
}
});
//Ext.getCmp("lineCodeForm").items.itemAt(1).setValue(objs);
/*Ext.getCmp("lineCodeForm").form.submit({
url:"http://139.28.96.10:8080/scan/secure/taxcase",
method:"POST",
params:{
taxpayid:"taxpayid",
bojs:objs
},
success:function(form,action) {
Ext.Msg.alert("提示信息","删除成功");*/
//Ext.getCmp("savedGrid").getStore().reload();
//Ext.getCmp("savedGrid").getView().refresh();
/*
}
});*/
}
}
]
});
}
});
/**********************************************************/
PersonRegistrationGridPanel = Ext.extend(Ext.Panel,{
personRegistrationGrid:null,
constructor:function() {
this.personRegistrationGrid = new PersonRegistrationGrid();
PersonRegistrationGridPanel.superclass.constructor.call(this,{
frame:true,
height:200,
items:[this.personRegistrationGrid]
});
}
});
/******************************************************************/
PersonRegistrationGrid = Ext.extend(Ext.grid.EditorGridPanel,{
lineCodeStore:null,
constructor:function() {
this.lineCodeStore = new LineCodeStore();
PersonRegistrationGrid.superclass.constructor.call(this,{
id:"personRegistrationGrid",
store:this.lineCodeStore,
height:200,
clicksToEdit:2,
columns:[{
header:"id",
dataIndex:"documentsid"
},{
header:"文档名称",
dataIndex:"documentsname"
},{
header:"条形码",
dataIndex:"linecode",
editor:new Ext.form.TextField({
listeners:{
blur:function(k,e){
},
keyup:function(textfield,e) {
//alert("12121");
},
specialkey:function(field,e) {
if(e.getKey()==e.ENTER) {
e.keyCode=9;
}
}
}
})
}],
viewConfig:{
forceFit:true
},
listeners:{
afteredit:function(e){
}
}
});
}
});
/********************************************************************/
LineCodeStore = Ext.extend(Ext.data.JsonStore,{
constructor:function() {
LineCodeStore.superclass.constructor.call(this,{
url:"http://139.28.96.10:8080/scan/secure/taxrelated?id=1",
storeId:"lineCodeStore",
root:"documentses",
autoLoad:true,
sortInfo:{
field:"documentsid",
direction:"asc"
},
//totalProperty:"total",
fields:[{
name:"documentsid",
mapping:"id"
},{
name:"documentsname",
mapping:"documentsname"
},{
name:"linecode",
mapping:""
}]
});
}
});
后台Action页面
public class TaxcaseAction extends ActionSupport {
//private JSONArray arr = new JSONArray();
private String[] result = null;
private Boolean success = false;
private String taxpayid;
private Taxcase taxcase;
private TaxcaseService taxcaseService;
private TaxpayerService taxpayerService;
@Override
public String execute() throws Exception {
Taxpayer taxpayer = this.taxpayerService.getTaxpayer(1);
//System.out.println(this.taxpayerService.getTaxpayer(1).getPayername());
//this.taxcase.setTaxpayer(taxpayer);
//this.taxcaseService.add(taxcase);
//System.out.println(result[0].indexOf("]"));
//String s = "{"+result[0].substring(1, 166)+"}";
JSONArray arr = JSONArray.fromObject(result[0]);//这里要注意是result[0]
System.out.println(arr.toArray());
Object[] o = arr.toArray();
for(Object obj:o) {
System.out.println(obj);
JSONObject json = (JSONObject)obj;
TaxcaseValue taxcaseValue = (TaxcaseValue)JSONObject.toBean(json,TaxcaseValue.class);
this.taxcase = taxcaseValue.gettaxcase();
this.taxcase.setTaxpayer(taxpayer);
this.taxcaseService.add(taxcase);
}
this.success = true;
return SUCCESS;
}
本来按照查询的资料前台传过来的是array,但JSONArray.fromObject不执行也不报错
后来通过Debug发现数据在[0]里面,不然JSONObject.toBean也是不执行也不报错,当然这之前json-lib的依赖包也不对,看来版本也是要兼容的
PersonRegistration = Ext.extend(Ext.Panel,{
personRegistrationForm:null,
personRegistrationGridPanel:null,
constructor:function() {
this.personRegistrationForm = new PersonRegistrationForm();
this.personRegistrationGridPanel = new PersonRegistrationGridPanel();
PersonRegistration.superclass.constructor.call(this,{
renderTo:"getLineCode",
autoWidth:true,
items:[this.personRegistrationForm,this.personRegistrationGridPanel]
});
}
});
/*****************************************************/
PersonRegistrationForm = Ext.extend(Ext.form.FormPanel,{
constructor:function() {
PersonRegistrationForm.superclass.constructor.call(this,{
id:"lineCodeForm",
height:100,
frame:true,
defaultType:"textfield",
buttonAlign:"left",
standarSubmit:true,
items:[{
name:"taxpayid",
allowBlank:false,
fieldLabel:"计算机代码"
}],
buttons:[
{
text:"保存",
handler:function() {
var storeValue = Ext.getCmp("personRegistrationGrid").getStore();
//var m = storeValue.getModifiedRecords();
var jsonarray=[];
//Ext.each(m,function(item){jsonArray.push(item.data);});
storeValue.each(function(item){
//jsonarray.push(item.get("documentsid")+","+item.get("linecode"));
jsonarray.push(item.data);
});
var result = Ext.encode(jsonarray);
/*var lineCodeForm = Ext.getCmp("lineCodeForm");
var count = storeValue.getCount();
var _rd = 0;
lineCodeForm.form.loadRecord(storeValue.getAt(0));*/
Ext.getCmp("lineCodeForm").form.submit({
url:"http://139.28.96.10:8080/scan/secure/taxcase",
method:"POST",
params:{
result:result
},
waitTitle:"提交数据",
waitMsg:"正在提交,请稍后",
success:function(form,action) {
//alert(action.result.success);
Ext.Msg.alert("提示信息","提交成功");
//Ext.getCmp("savedGrid").getStore().reload();
//Ext.getCmp("savedGrid").getView().refresh();
}
});
//Ext.getCmp("lineCodeForm").items.itemAt(1).setValue(objs);
/*Ext.getCmp("lineCodeForm").form.submit({
url:"http://139.28.96.10:8080/scan/secure/taxcase",
method:"POST",
params:{
taxpayid:"taxpayid",
bojs:objs
},
success:function(form,action) {
Ext.Msg.alert("提示信息","删除成功");*/
//Ext.getCmp("savedGrid").getStore().reload();
//Ext.getCmp("savedGrid").getView().refresh();
/*
}
});*/
}
}
]
});
}
});
/**********************************************************/
PersonRegistrationGridPanel = Ext.extend(Ext.Panel,{
personRegistrationGrid:null,
constructor:function() {
this.personRegistrationGrid = new PersonRegistrationGrid();
PersonRegistrationGridPanel.superclass.constructor.call(this,{
frame:true,
height:200,
items:[this.personRegistrationGrid]
});
}
});
/******************************************************************/
PersonRegistrationGrid = Ext.extend(Ext.grid.EditorGridPanel,{
lineCodeStore:null,
constructor:function() {
this.lineCodeStore = new LineCodeStore();
PersonRegistrationGrid.superclass.constructor.call(this,{
id:"personRegistrationGrid",
store:this.lineCodeStore,
height:200,
clicksToEdit:2,
columns:[{
header:"id",
dataIndex:"documentsid"
},{
header:"文档名称",
dataIndex:"documentsname"
},{
header:"条形码",
dataIndex:"linecode",
editor:new Ext.form.TextField({
listeners:{
blur:function(k,e){
},
keyup:function(textfield,e) {
//alert("12121");
},
specialkey:function(field,e) {
if(e.getKey()==e.ENTER) {
e.keyCode=9;
}
}
}
})
}],
viewConfig:{
forceFit:true
},
listeners:{
afteredit:function(e){
}
}
});
}
});
/********************************************************************/
LineCodeStore = Ext.extend(Ext.data.JsonStore,{
constructor:function() {
LineCodeStore.superclass.constructor.call(this,{
url:"http://139.28.96.10:8080/scan/secure/taxrelated?id=1",
storeId:"lineCodeStore",
root:"documentses",
autoLoad:true,
sortInfo:{
field:"documentsid",
direction:"asc"
},
//totalProperty:"total",
fields:[{
name:"documentsid",
mapping:"id"
},{
name:"documentsname",
mapping:"documentsname"
},{
name:"linecode",
mapping:""
}]
});
}
});
后台Action页面
public class TaxcaseAction extends ActionSupport {
//private JSONArray arr = new JSONArray();
private String[] result = null;
private Boolean success = false;
private String taxpayid;
private Taxcase taxcase;
private TaxcaseService taxcaseService;
private TaxpayerService taxpayerService;
@Override
public String execute() throws Exception {
Taxpayer taxpayer = this.taxpayerService.getTaxpayer(1);
//System.out.println(this.taxpayerService.getTaxpayer(1).getPayername());
//this.taxcase.setTaxpayer(taxpayer);
//this.taxcaseService.add(taxcase);
//System.out.println(result[0].indexOf("]"));
//String s = "{"+result[0].substring(1, 166)+"}";
JSONArray arr = JSONArray.fromObject(result[0]);//这里要注意是result[0]
System.out.println(arr.toArray());
Object[] o = arr.toArray();
for(Object obj:o) {
System.out.println(obj);
JSONObject json = (JSONObject)obj;
TaxcaseValue taxcaseValue = (TaxcaseValue)JSONObject.toBean(json,TaxcaseValue.class);
this.taxcase = taxcaseValue.gettaxcase();
this.taxcase.setTaxpayer(taxpayer);
this.taxcaseService.add(taxcase);
}
this.success = true;
return SUCCESS;
}
本来按照查询的资料前台传过来的是array,但JSONArray.fromObject不执行也不报错
后来通过Debug发现数据在[0]里面,不然JSONObject.toBean也是不执行也不报错,当然这之前json-lib的依赖包也不对,看来版本也是要兼容的
发表评论
-
list遍历 的奇怪问题
2012-02-19 19:59 664今天用extjs做了一棵树 从后台首先得到了set结合 然后用 ... -
tree节点的排序
2012-02-19 15:46 762我的tree是从后台得到的Set集合,所以顺序不稳定,所以看了 ... -
action不执行的低级错误
2012-02-18 11:10 614太惭愧,太惭愧,这个错误怎么经常犯呢,action中的属性没有 ... -
EditorGridPanel 加载问题
2012-02-04 15:27 807今天的问题是本项目从数据库中加载表到EditorGridPan ... -
myeclipse permSize的问题
2011-11-19 19:41 715和这个问题斗争了一个下午,看了很多帖子,但都没有很好地解决 最 ... -
while loading persisted sessions: java.io.EOFException
2011-11-19 19:39 677第二次遇到这个问题,忘了怎么解决了,记下来 原因: EOFE ... -
ssh整合备忘
2011-11-17 16:39 750好久没有用ssh了,忘得差不多了整理一下备忘 1、java w ... -
extjs的边框
2011-06-23 11:08 871刚刚做了一棵树,郁闷的是总是有边框,开始设置的是margins ... -
Action没有访问到的一种情况
2011-06-21 16:19 668今天做小联系,上面的Action可以访问到,下面的却没有能够访 ... -
extjs 文件下在链接的写法
2011-02-23 16:22 1207文件下载如果简易的些,可以直接把文件路径地址写在那里,当然也可 ... -
action没有访问到的一种情况
2011-02-23 09:48 686今天写了一个小的测试form表单的url属性设置为“http: ... -
extjs dategird的刷新问题
2011-02-11 14:43 715作了一个小的dategrid,选中一条记录点击发送后该纪录应从 ... -
there is no action mapped for namespace action name的一种情况
2010-12-28 15:09 924写了struts2一个加载gridpanel的action在里 ... -
关于gridpanel无法显示的问题
2010-12-27 16:18 751在做一个gridpanel,反复写了很多遍,但在前台老是提示g ... -
关于extjs textfield hidden属性的注意
2010-12-26 15:33 1447原来只把textfield的hidden属性设置成true在前 ... -
extjs textfield disabled属性的注意
2010-12-26 15:13 2724学习了extjs的textfield 其中有两项内容是页面加载 ...
相关推荐
使用EXT的EditorGrid,实现前台页面对数据直接进行增删改查操作。用户的友好性较好,已经实现分页功能。例子中使用了DWR和JSON.含MySQL数据库脚本,并已加入Log4j日志记录。本例详细讲解可以参见:...
3.9.2 通过后台脚本获得分页数据 49 3.9.3 分页工具栏显示在Grid的顶部 51 3.9.4 让EXT支持前台排序 52 3.10 后台排序 53 3.11 可编辑表格控件--EditorGrid 55 3.11.1 制作一个简单的EditorGrid 55 3.11.2 ...
此文档是可编辑表格Ext.grid.EditorGridPanel的说明以及示例的源代码,放到eclipse里面即可运行,显示出效果!
Tree与EditorGrid结合在一起,树形的展示结构,可以对其中的数据进行编辑,类似RowEditor.
本书共分17章,分别介绍了JavaScript的对象编程、JavaScript浏览器对象模型和事件机制、ExtJS的核心类库和组件、ExtJS的事件处理方式、设计进度条、设计工具栏和菜单栏、设计面板、设计表格、设计表单、设计数据表、...
本书共分17章,分别介绍了JavaScript的对象编程、JavaScript浏览器对象模型和事件机制、ExtJS的核心类库和组件、ExtJS的事件处理方式、设计进度条、设计工具栏和菜单栏、设计面板、设计表格、设计表单、设计数据表、...
8.3.2. 批量生成还是需要Template模板 8.4. Ext.data命名空间 8.4.1. proxy系列 8.4.1.1. 人畜无害的MemoryProxy 8.4.1.2. 常规武器HttpProxy 8.4.1.3. 洲际导弹ScriptTagProxy 8.4.2. reader系列 8.4.2.1. ...
8.3.2. 批量生成还是需要Template模板 8.4. Ext.data命名空间 8.4.1. proxy系列 8.4.1.1. 人畜无害的MemoryProxy 8.4.1.2. 常规武器HttpProxy 8.4.1.3. 洲际导弹ScriptTagProxy 8.4.2. reader系列 8.4.2.1. 简单易行...
8.3.2. 批量生成还是需要Template模板 8.3.3. 醍醐灌顶,功能强劲的模板引擎XTemplate。 8.4. Ext.data命名空间 8.4.1. proxy系列 8.4.1.1. 人畜无害MemoryProxy 8.4.1.2. 常规武器HttpProxy 8.4.1.3. 洲际导弹...
当然还有很多地方需要优化,例如实现描述性的列标题(而不是以字段名做为列标题),配置列宽和对齐方式,实现 Dynamic EditorGrid等,通常我们还需要一个配置档,将这些原先硬编码的信息在配置档里配置好,然后在...
说实话, 我也是特别懒的人, 很早就想看看 Ext, 尤其是做一个实时编辑的带后台的表格例子, 一直没能深入, 今天抽时间深入看了看 Ext 的 EditorGrid,可编辑的表格控件,总算凑出来了个实时增删改的例子(不单独弹出添加...
c)扩展高级插件editorgrid(可动态的添加、修改、删除行,对行的单元格进行编辑)(授权用户可用) d)扩展高级插件grid扩展列插件(授权用户可用) EfsFrame主要特点: 基于Ext的优秀企业级开源框架(精通一种、...
c)扩展高级插件editorgrid(可动态的添加、修改、删除行,对行的单元格进行编辑)(授权用户可用) d)扩展高级插件grid扩展列插件(授权用户可用) EfsFrame主要特点: 基于Ext的优秀企业级开源框架(精通一种、...
c)扩展高级插件editorgrid(可动态的添加、修改、删除行,对行的单元格进行编辑)(授权用户可用) d)扩展高级插件grid扩展列插件(授权用户可用) EfsFrame主要特点: 基于Ext的优秀企业级开源框架(精通一种...
c)扩展高级插件editorgrid(可动态的添加、修改、删除行,对行的单元格进行编辑)(授权用户可用) d)扩展高级插件grid扩展列插件(授权用户可用) EfsFrame主要特点: 基于Ext的优秀企业级开源框架(精通一种、...