extjs 之Ext.data.Store变更单行记录值【修改】

简介:

1.record声明如下

machineuse_record = Ext.data.Record.create([{
name : 'id',
type : 'int'
}, {
name : 'projectname',
type : 'string'
}, {
name : 'projectid',
type : 'int'
}, {
name : 'ip',
type : 'string'
}, {
name : 'server',
type : 'string'
}]);
 

 

2.datastor声明如下

machineuse_list_grid_store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : 'GetMachineUseList',
method : 'POST'
}),
reader : new Ext.data.JsonReader({
root : "root",
id : 'machineuse_list_grid_store',
totalProperty : 'totalCount'
}, machineuse_record)
});
 

 

3. grid声明如下

machineuse_list_grid = new Ext.grid.GridPanel({
store : machineuse_list_grid_store,
animate : true,
columnLines : true,
region : 'south',
height :Glb.outer_center.getHeight() * 0.63,
tbar : [p_buttons],
split : true,
autoScroll:true,
columns : [{
id : 'id',
header : "id",
width : 60,
sortable : true,
dataIndex : 'id'
}, {
id : 'ip',
header : "机器ip",
width : 120,
sortable : true,
dataIndex : 'ip'
}, {
id : 'server',
header : "部署服务",
width : 80,
sortable : true,
dataIndex : 'server'
}, {
id : 'projectname',
header : "项目",
width : 120,
sortable : true,
dataIndex : 'projectname'
},
{
id : 'projectid',
header : "项目id",
width : 120,
sortable : true,
dataIndex : 'projectid',
hidden: true
}],
region : 'south',
bbar : new Ext.PagingToolbar({
pageSize : 10,
store : machineuse_list_grid_store,
displayInfo : true,
displayMsg : '显示 {0} - {1} /共 {2}条记录',
emptyMsg : "没有记录"
})
});
 

4. 通过修改datastore记录来修改grid某行的值

var rec = machineuse_list_grid_store.getAt(g_machine_rowIndex);
rec.set('ip', ip);
rec.set('server', env);
rec.set('projectid', owner);
rec.set('projectname', owner);
rec.commit();


本文转自elbertchen 51CTO博客,原文链接:http://blog.51cto.com/linkyou/751883,如需转载请自行联系原作者
相关文章
|
前端开发 JavaScript 安全
【网络安全】WebPack源码(前端源码)泄露 + jsmap文件还原
【网络安全】WebPack源码(前端源码)泄露 + jsmap文件还原
2732 0
|
Linux 网络安全 开发工具
远程代码托管平台--GitHub、Gitee的使用(1)
远程代码托管平台--GitHub、Gitee的使用(1)
1486 0
远程代码托管平台--GitHub、Gitee的使用(1)
|
Java Maven
Maven - 报错篇
Maven - 报错篇
805 0
Maven - 报错篇
|
编译器 C语言 C++
C/C++ 中的 sizeof 运算符和 size_t 类型
C/C++ 中的 sizeof 运算符和 size_t 类型
|
4天前
|
搜索推荐 编译器 Linux
一个可用于企业开发及通用跨平台的Makefile文件
一款适用于企业级开发的通用跨平台Makefile,支持C/C++混合编译、多目标输出(可执行文件、静态/动态库)、Release/Debug版本管理。配置简洁,仅需修改带`MF_CONFIGURE_`前缀的变量,支持脚本化配置与子Makefile管理,具备完善日志、错误提示和跨平台兼容性,附详细文档与示例,便于学习与集成。
298 116
|
19天前
|
域名解析 人工智能
【实操攻略】手把手教学,免费领取.CN域名
即日起至2025年12月31日,购买万小智AI建站或云·企业官网,每单可免费领1个.CN域名首年!跟我了解领取攻略吧~
|
7天前
|
数据采集 人工智能 自然语言处理
Meta SAM3开源:让图像分割,听懂你的话
Meta发布并开源SAM 3,首个支持文本或视觉提示的统一图像视频分割模型,可精准分割“红色条纹伞”等开放词汇概念,覆盖400万独特概念,性能达人类水平75%–80%,推动视觉分割新突破。
477 44
Meta SAM3开源:让图像分割,听懂你的话