gridPanel

(function(){
Ext.QuickTips.init();
var grid = Ext.create('Ext.grid.Pale',{
title:'parentName',
frame:true,
forceFit:true,
width:890,
height:400
columns:[
{text:'name',dataIndex:'name'},
{text:'age',dataIndex:'age'},
{text:'mail',dataIndex:'mail',
field:[
xtype:'textfield',
allowBlank:false
]

}
],
tbar:[
{xtype:'button' text:'添加',iconcls:'table_add'},
{xtype:'button' text:'删除',iconcls:'table_remove'},
handler:function(o){
// var grid = o.findParentByType('gridpanel');//获得父类的panle
var grid = o.ownerCt.ownerCt;
var data = grid.getSelectionModel.getSelection();

if( data.length ==0){

Ext.Msg.alert('提示','至少选址一条数据');

}else{

var st = grid.getStore();//得到ID数据
var ids=[];
Ext.Array.each(data,function(records){
ids.push(records.get('name'));

})
Ext.Ajax.request({
url:'',
params:{ids:ids.join(',')},
method:'POST',
timeout:2000,
success: function(response,opts){

Ext.Array.each(data,function(records){
st.remove(records);

})
}

})

}
}


{xtype:'button' text:'修改',iconcls:'table_edit'},
{xtype:'button' text:'查看',iconcls:'table_comm'}

],
docketItems:[
xtype:'pagingtoolbar',
store:Ext.data.StoreManager.lookup('s_user'),
dock:'buttom',
displayInfo:true

],
plugins:[//添加单元格可编辑插件
Ext.create('Ext.grid.plugin.CellEditing',{
clicksToedit:1
});

],

setType:'checkboxmodel',//定义chekbox复选框
multiSelect:true,//允许多选
renderTo:'divId',
store:Ext.data.StoreManager.lookup('s_user')
});

});

})();

-----------------------------------------------------------------------------
Ext.define('user',{
extend:'Ext.data.Model',
fields:[
{name:'name',type:'string',sortable:true},
{name:'age',int:'string',sortable:true},
{name:'mail',type:'string',sortable:true}
]


});

Ext.create('Ext.data.Stroe',{
model:'user',
storeId:'s_user',
proxy :{

type:'ajax',
url:'testurl'
reader:{
type:'json',
root:'topis'//json 根节点 就是对象数组前节点名称
},
writer: {
type:'json'

}
},
autoLoad:true


});
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值