//SiteVariableConfigValue类,创立一个模型类
Ext.define("SiteVariableConfigValue", {
extend: "Ext.data.Model",
fields: [
{ name: 'SVCValueId', type: 'int', sortable: true },
{ name: 'SVCId', type: 'string', sortable: true },
{ name: 'KeyInItem', type: 'string', sortable: true },
{ name: 'ValueInItem', type: 'string', sortable: true }
]
}); var storeSiteVariableConfigValue = Ext.create('Ext.data.Store', {
model: 'SiteVariableConfigValue',//这个地方CarAccessoriesType不是一个对象,而是一个类
pageSize: limit, //页容量20条数据
//是否在服务端排序 (true的话,在客户端就不能排序)
remoteSort: false,
remoteFilter: true,
method: 'POST',
proxy: {//代理
type: 'ajax',
url: '/UI/HttpHandlerData/InformationManagement/InformationManagement.ashx?operation=SearchInfoCollection1',
extraParams: {
start: start,
limit: limit
},
reader: { //这里的reader为数据存储组织的地方,下面的配置是为json格式的数据,例如:[{"total":50,"rows":[{"a":"3","b":"4"}]}]//读取器
type: 'json', //返回数据类型为json格式
root: 'Table', //根节点
totalProperty: 'result' //数据总条数
}
},
sorters: [{
//排序字段。
property: 'SVCValueId',
//排序类型,默认为 ASC
direction: 'desc'
}],
autoLoad: true //即时加载数据
}); var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
clicksToMoveEditor: 1,
autoCancel: false
}); var gridSiteVariableConfigValue = Ext.create('Ext.grid.Panel', {
store: storeSiteVariableConfigValue,
autoWidth: true,
aotuHeight: true,
animCollapse: false,
enableColumnMove: false,
enableHdMenu: false,
loadMask: true,
loadMask: {
msg: '正在载入数据,请稍候...'
},
viewConfig: {
forceFit: true,
stripeRows: true
},
forceFit: true, //列表宽度自适应
stripeRows: true,//斑马线
autoSizeColumns: true, //根据每一列内容的宽度自适应列的大小
trackMouseOver: true, //鼠标移动时高亮显示
selModel: { selType: 'checkboxmodel' }, //选择框
scroll: true,
layout: 'column', // Specifies that the items will now be arranged in columns
columnWidth: 0.60,
plugins: [rowEditing],
columns: [
{ header: '序号', xtype: 'rownumberer', align: 'left', width: 50 },
{
header: '键', dataIndex: 'KeyInItem', width: 200, editor: {
// xtype: 'textfield'
}
},
{
header: '值', dataIndex: 'ValueInItem', width: 200, editor: {
// xtype: 'textfield'
}
}, ],
bbar: [{
xtype: 'pagingtoolbar',
store: storeSiteVariableConfigValue,
displayMsg: '显示 {0} - {1} 条,共计 {2} 条',
emptyMsg: "没有数据",
beforePageText: "当前页",
afterPageText: "共{0}页",
displayInfo: true
}],
tbar: [{
text: '添加',
icon: '/Resources/Images/16x16_easyui/edit_add.png',
handler: function () {
rowEditing.cancelEdit();
var r = Ext.create('SiteVariableConfigValue', {
KeyInItem: '这里是键',
ValueInItem: '这里是值'
}); gridSiteVariableConfigValue.getStore().insert(0, r);
rowEditing.startEdit(0, 0);
}
}, {
text: '删除',
icon: '/Resources/Images/16x16_easyui/edit_remove.png',
handler: function () {
Ext.MessageBox.confirm('Confirm', '确定删除该记录?', function (btn) {
if (btn != 'yes') {
return;
}
var sm = gridSiteVariableConfigValue.getSelectionModel();
rowEditing.cancelEdit();
var store = gridSiteVariableConfigValue.getStore();
store.remove(sm.getSelection());
if (store.getCount() > 0) {
sm.select(0);
}
});
},
disabled: true
}]
});

EXTJS 4.2 资料 控件之Grid 添加行,编辑行,删除行的更多相关文章

  1. EXTJS 4.2 资料 控件之Grid 那些事

    最近在学习Extjs4.2 ,积累文章,看得不错,再此留年: //表格数据最起码有列.数据.转换原始数据这3项 Ext.onReady(function(){ //定义列 var columns = ...

  2. EXTJS 4.2 资料 控件之Grid 行编辑绑定下拉框,并点一次触发一次事件

    主要代码: { header: '属性值', dataIndex: 'PropertyValueName', width: 130, editor: new Ext.form.field.ComboB ...

  3. EXTJS 4.2 资料 控件之Grid Columns 列renderer 绑定事件

    columns: [ { header: '序号', xtype: 'rownumberer', align: 'center', width: 100 }, { header: 'CompanyId ...

  4. EXTJS 4.2 资料 控件之Grid 列鼠标悬停提示

    columns: [ { header: }, { header: }, { header: , renderer: function (v, ctx, record) { ctx.tdAttr = ...

  5. EXTJS 3.0 资料 控件之 html 潜入label用法

    这是在Extjs 中插入html 控件label! html: "<div><label id='howMany'>您共选中了</label><br ...

  6. EXTJS 3.0 资料 控件之 combo 用法

    EXTJS combo 控件: 1.先定义store //年款 var comboData_ReleasYear = [ ['], ['], ['], ['] ]; 2.定义combo控件 { lay ...

  7. EXTJS 4.2 资料 控件之combo 联动

    写两个数据源: 1.IM_ST_Module.js { success:true, data:[ { ModuleId: '1', ModuleName: '资讯' } , { ModuleId: ' ...

  8. EXTJS 4.2 资料 控件textfield中fieldLabel去掉冒号,控件label的长度

    代码: labelSeparator: '', // 去掉laebl中的冒号 labelWidth: 10,//控件label的长度

  9. EXTJS 4.2 资料 控件之 Store 用法

    最近工作,发现在Extjs中自定义Store的功能挺多,特意在此做笔记,几下来,具体代码如下: 1.定义Store //定义Store var ItemSelectorStore = new Ext. ...

随机推荐

  1. MySQL中的保留字

    本文转载自:http://www.cnblogs.com/lawdong/archive/2010/08/08/2357903.html ADD ALL ALTER ANALYZE AND AS AS ...

  2. [改善Java代码]不要覆写静态方法

    建议33: 不要覆写静态方法 我们知道在Java中可以通过覆写(Override)来增强或减弱父类的方法和行为,但覆写是针对非静态方法(也叫做实例方法,只有生成实例才能调用的方法)的,不能针对静态方法 ...

  3. 转:Nginx RTMP 功能研究

    看点: 1.    Nginx 配置信息与使用.  (支持 rtmp与HLS配置) 2.    有ffmpeg 编译与使用,    命令行方式来测试验证客户端使用. 转自:http://blog.cs ...

  4. linux两种增加交换分区(swap)的方法

    在安装Oracle后,为使Oracle流畅运行,需要手动增加linux的交换分区(相当于Windows下的虚拟内存)的大小,本文介绍两种增加交换分区(swap)的方法. 第一种方法:新建分区 1.fd ...

  5. Microsoft.Practices.EnterpriseLibrary企业库问题

    System.Configuration.ConfigurationErrorsException: Invalid TraceListenerData type in configuration ' ...

  6. 【转载】Kafka实现篇之消息和日志

    http://blog.csdn.net/honglei915/article/details/37760631 消息格式 日志 一个叫做“my_topic”且有两个分区的的topic,它的日志有两个 ...

  7. kettle

    Kettle(中文名称叫水壶)是一款ETL工具,纯java编写,可以在Window.Linux.Unix上运行,绿色无需安装,数据抽取高效稳定.Kettle家族包括4个产品:Spoon.Pan.CHE ...

  8. DWR应用—快速入门篇

    DWR(Direct Web Remoting)是一个Ajax的开源框架,用于改善web页面与Java类交互的远程服务器端的交互体验. 官网:http://directwebremoting.org/ ...

  9. 函数 sort,unique,stable_sort,count_if,谓词

    bool isShorter(const string &s1,const string &s2) { return s1.size() < s2.size(); } bool ...

  10. Android Studio生成APK自动追加版本号

    转载说明 本篇文章可能已经更新,最新文章请转:http://www.sollyu.com/android-apk-studio-generated-automatically-appends-a-ve ...