extjs2.0 本人自己研究所得,包里有sql文件,自己创建吧!应该适合新手入门吧!
//操作编辑
var onedit = function(id){
ext.onready(function(){
var fs = new ext.form.formpanel({
basecls: 'x-plain',
layout:'absolute',
//url:'grid-filter.php',
defaulttype: 'textfield',
// configure how to read the json data
reader : new ext.data.jsonreader({
root : 'data',
successproperty: 'true',
},[
'product_name',
{name:'product_sell',mapping:'product_sell_price'},
{name:'product_purchas',mapping:'product_purchasing_price'}
]),
// reusable eror reader class defined at the end of this file
//errorreader: new ext.form.jsonerrorreader(),
items: [
new ext.form.fieldset({
title: '产品信息',
autoheight: true,
defaulttype: 'textfield',
items: [
{
fieldlabel: '产品名',
name: 'product_name',
width:190
}, {
fieldlabel: '市场价',
name: 'product_sell',
width:190
}, {
fieldlabel: '采购价',
name: 'product_purchas',
width:190
}
]
})
]
});
// explicit add
var submit = fs.addbutton({
text: '保存',
handler: function(){
fs.getform().submit({
url:'grid-filter.php?action=update',
params:{id: id},
waitmsg:'保存数据中...',
success:function(){
ext.msg.alert('成功', '修改成功');
create.hide();
ds.reload();
}
});
}
});
var create = new ext.window({
title: '编辑数据',
width: 500,
height:200,
minwidth: 300,
minheight: 200,
layout: 'fit',
plain:true,
bodystyle:'padding:5px;',
buttonalign:'center',
items: fs,
});
fs.getform().load({url:'grid-filter.php?action=edit',params:{id: id},waitmsg:'loading'});
create.show();
});