gridpanel某一列可编辑和某一列加复选框 storeextjsgridpanel 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可编辑在column中设置,editor:{xtype:'textfield',allowBlank:false}, var rolecols = [{ width:25, renderer:function(value) { return '<img src= ././image/role.png />'; } },{ text:'角色编号', dataIndex:'rolecode', width:100 },{ text:'角色名称', dataIndex:'rolename', editor:{xtype:'textfield',allowBlank:false}, width:200 },{ text:'描述', dataIndex:'describe', editor:{xtype:'textfield'}, flex:1 }];gridpanel中设置列为上面的变量 var gridrole = Ext.create('RoleGrid',{ id:'gridrole', columns:rolecols, tbar:rolebar, border:false, plugins: [ Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 })] }); 刚刚我们项目组长给了另外一个方法,版主可以看下 我是在Sencha Architect上运行实现的,组长在store显示的数据组中添加了CellEditingPlugin事件,再在grid中添加了xtype: 'gridcolumn', width: 50, dataIndex: '', text: 'Mark', editor: { xtype: 'textfield', enableKeyEvents: true }这一句,也能实现列的编辑问题。不过版主知道怎么在下面添加的保存按钮中添加保存的代码?组长写的是var store=Ext.getCmp('gridZhuguan').store;还要添加updataData()代码么? 刚刚我们项目组长给了另外一个方法,版主可以看下 我是在Sencha Architect上运行实现的,组长在store显示的数据组中添加了CellEditingPlugin事件,再在grid中添加了xtype: 'gridcolumn', width: 50, dataIndex: '', text: 'Mark', editor: { xtype: 'textfield', enableKeyEvents: true }这一句,也能实现列的编辑问题。不过版主知道怎么在下面添加的保存按钮中添加保存的代码?组长写的是var store=Ext.getCmp('gridZhuguan').store;还要添加updataData()代码么?刚用Ext做完一个工程,也是操纵大量ChineseTable的 。 回到问题。”“” 不过版主知道怎么在下面添加的保存按钮中添加保存的代码?“”“简单说下我理解的store你从后台取得的数据,应该是先配置到store里面,然后再将store配置到grid里面。(注意columns和fields的对应,col应该是fields的子集。)这时候你在前台做的任何编辑表格的东西,都不回对store造成实质的数据变化。因为每一条record都有一个raw数值,来保存原来的数据。 这时候:::1、你如果只是想暂时的保存在客户端,可以使用sync方法,就可以将数据同步到前台也就是单元格的左上角的小红点消失了。2、如果想保存到客户端,就从store里取数据,发送到server保存,然后回显到前台,也能实现同步。可能一些名词或想法解释有错。 具体的可以查下DOCS。 祝好! { text:'保存', iconCls:'saveicon', handler:function(){ gridrolestore.sync({ success:function(optional){ Ext.MessageBox.alert('提示','保存成功'); } }); } },我用的是批量提交的方法,调用store的sync方法,它会将所有修改的记录组织成json传递到后台下面是store的定义,里面定义了api var gridrolestore = Ext.create('Ext.data.Store',{ model:Role_Model, proxy:{ type:'ajax',// url:'././RoleServlet', api:{ read:'././RoleServlet', create:'././RoleServlet?optype='+OPERATION_NEW, update:'././RoleServlet?optype='+OPERATION_EDIT, destroy:'././RoleServlet?optype='+OPERATION_DEL }, reader:{ type:'json', root:'items', idProperty:'rolecode', messageProperty:'msg' }, writer:{ type:'json', writeAllFields:false, root:'data', allowSingle:false } } }); Jquery $(#id).html的问题 用js 怎么采集网页信息 动态换皮肤问题 a链接下href属性中写javascript和普通的javascript有没有区别 数组求重复元素问题! 简单问题,解决马上给分!!! 求救:高手帮忙看看,谢谢! 欢迎和我联系! 为什么焦点在text里面的时候,按下Enter的效果就是刷新整个页面,如何去掉这个动作? <input type="file"控件能触发事件吗? jquery mobile 多选框无效 关于多页面之间切换的问题 如何把php文件伪装成js文件
width:25,
renderer:function(value)
{
return '<img src= ././image/role.png />';
}
},{
text:'角色编号',
dataIndex:'rolecode',
width:100
},{
text:'角色名称',
dataIndex:'rolename',
editor:{xtype:'textfield',allowBlank:false},
width:200
},{
text:'描述',
dataIndex:'describe',
editor:{xtype:'textfield'},
flex:1
}];gridpanel中设置列为上面的变量 var gridrole = Ext.create('RoleGrid',{
id:'gridrole',
columns:rolecols,
tbar:rolebar,
border:false,
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
})]
});
我是在Sencha Architect上运行实现的,组长在store显示的数据组中添加了CellEditingPlugin事件,再在grid中添加了xtype: 'gridcolumn',
width: 50,
dataIndex: '',
text: 'Mark',
editor: {
xtype: 'textfield',
enableKeyEvents: true
}
这一句,也能实现列的编辑问题。
不过版主知道怎么在下面添加的保存按钮中添加保存的代码?
组长写的是var store=Ext.getCmp('gridZhuguan').store;
还要添加updataData()代码么?
我是在Sencha Architect上运行实现的,组长在store显示的数据组中添加了CellEditingPlugin事件,再在grid中添加了xtype: 'gridcolumn',
width: 50,
dataIndex: '',
text: 'Mark',
editor: {
xtype: 'textfield',
enableKeyEvents: true
}
这一句,也能实现列的编辑问题。
不过版主知道怎么在下面添加的保存按钮中添加保存的代码?
组长写的是var store=Ext.getCmp('gridZhuguan').store;
还要添加updataData()代码么?刚用Ext做完一个工程,也是操纵大量ChineseTable的 。
回到问题。”“” 不过版主知道怎么在下面添加的保存按钮中添加保存的代码?“”“
简单说下我理解的store
你从后台取得的数据,应该是先配置到store里面,然后再将store配置到grid里面。(注意columns和fields的对应,col应该是fields的子集。)
这时候你在前台做的任何编辑表格的东西,都不回对store造成实质的数据变化。因为每一条record都有一个raw数值,来保存原来的数据。
这时候:::
1、你如果只是想暂时的保存在客户端,可以使用sync方法,就可以将数据同步到前台也就是单元格的左上角的小红点消失了。
2、如果想保存到客户端,就从store里取数据,发送到server保存,然后回显到前台,也能实现同步。
可能一些名词或想法解释有错。 具体的可以查下DOCS。
祝好!
{
text:'保存',
iconCls:'saveicon',
handler:function(){
gridrolestore.sync({
success:function(optional){
Ext.MessageBox.alert('提示','保存成功');
}
});
}
},我用的是批量提交的方法,调用store的sync方法,它会将所有修改的记录组织成json传递到后台
下面是store的定义,里面定义了api var gridrolestore = Ext.create('Ext.data.Store',{
model:Role_Model,
proxy:{
type:'ajax',
// url:'././RoleServlet',
api:{
read:'././RoleServlet',
create:'././RoleServlet?optype='+OPERATION_NEW,
update:'././RoleServlet?optype='+OPERATION_EDIT,
destroy:'././RoleServlet?optype='+OPERATION_DEL
},
reader:{
type:'json',
root:'items',
idProperty:'rolecode',
messageProperty:'msg'
},
writer:{
type:'json',
writeAllFields:false,
root:'data',
allowSingle:false
}
}
});