EXTJS 4.2 资料 控件之 Store 用法
最近工作,发现在Extjs中自定义Store的功能挺多,特意在此做笔记,几下来,具体代码如下:
1.定义Store
//定义Store
var ItemSelectorStore = new Ext.data.ArrayStore({
fields: [
{ name: 'BaseInfoId' },
{ name: 'Title' }
]
});
2.根据Grid的数据,循环往Store里面插
var selectedData = InfoCollectionGrid.getSelectionModel().getSelection();
if (selectedData.length < 1) {
Ext.MessageBox.alert('提示', '请选择要批量移动的记录!'); return;
}
else {
ItemSelectorFormWin_Move.show();
ItemSelectorFormWin_Move.setTitle("批量移动");
ItemSelectorStore.removeAll();
ItemSelectorStore_MoveDele.removeAll(); for (var i = 0; i < selectedData.length; i++) {
ItemSelectorStore.insert(i, { InfoCollectionId: selectedData[i].data.InfoCollectionId, Title: selectedData[i].data.Title });//插入到最后一行
ItemSelectorStore_MoveDele.insert(i, { InfoCollectionId: selectedData[i].data.InfoCollectionId });//插入到最后一行
} document.getElementById('howMany_Move').innerText = "共选择了" + selectedData.length + "篇文章";
}
3.循环读取Store中某行某列的数据
for (var i = ; i < ItemSelectorStore.getCount() ; i++) {
var record = ItemSelectorStore.getAt(i);
StrBaseInfoId += record.get("BaseInfoId") + ',';
}
上面这是获取的是列:BaseInfoId的数据。
4.移除grid中某行的数据(静态删除数据)
FunctionActionDelete_StyleFiles = function () {
if (gridJSFiles.getSelectionModel().getSelection()[] == null) {
Ext.MessageBox.alert('提示', '请选择要删除的记录吗!'); return;
}
var selectedData = gridJSFiles.getSelectionModel().getSelection()[].data;
Ext.Msg.confirm("提示!", "确定要删除的记录吗?", function (btn) {
if (btn == "yes") {
var sm = gridJSFiles.getSelectionModel();
var store = gridJSFiles.getStore();
store.remove(sm.getSelection());
if (store.getCount() > ) {
sm.select();
}
}
else { return; }
});
}
5.移除grid中某行的数据(动态删除数据)
FunctionActionDelete = function () {
if (grid.getSelectionModel().getSelection()[0] == null) {
Ext.MessageBox.alert('提示', '请选择要删除的记录吗!'); return;
}
var selectedData = grid.getSelectionModel().getSelection()[0].data;
Ext.Msg.confirm("提示!", "确定要删除的记录吗?", function (btn) {
if (btn == "yes") {
Ext.MessageBox.show({
msg: '正在删除,请稍等...',
progressText: 'Saving...',
width: 300,
wait: true,
waitConfig: { interval: 200 }
});
setTimeout(function () { }, 1000);
Ext.Ajax.request({
url: '/UI/HttpHandlerData/JDQP/JDQP.ashx?operation=DeleCarPartsType',
method: "POST",
params: {
CSId: selectedData.CSId
},
success: function (response) {
Ext.MessageBox.alert('提示', '删除成功!');
store.load({ params: { start: start, limit: limit } });
Ext.MessageBox.hide();
},
failure: function (errorInfo) {
Ext.MessageBox.alert("提示", "删除失败!<br>" + errorInfo.responseText);
}
});
}
});
}
EXTJS 4.2 资料 控件之 Store 用法的更多相关文章
- EXTJS 3.0 资料 控件之 combo 用法
EXTJS combo 控件: 1.先定义store //年款 var comboData_ReleasYear = [ ['], ['], ['], ['] ]; 2.定义combo控件 { lay ...
- EXTJS 3.0 资料 控件之 itemselector 用法
var dsform = new Ext.data.ArrayStore({ data: [[123, 'One Hundred Twenty Three'], ['1', '今天星期一'], ['2 ...
- EXTJS 3.0 资料 控件之 html 潜入label用法
这是在Extjs 中插入html 控件label! html: "<div><label id='howMany'>您共选中了</label><br ...
- EXTJS 4.2 资料 控件之combo 联动
写两个数据源: 1.IM_ST_Module.js { success:true, data:[ { ModuleId: '1', ModuleName: '资讯' } , { ModuleId: ' ...
- EXTJS 4.2 资料 控件之Grid 那些事
最近在学习Extjs4.2 ,积累文章,看得不错,再此留年: //表格数据最起码有列.数据.转换原始数据这3项 Ext.onReady(function(){ //定义列 var columns = ...
- EXTJS 4.2 资料 控件textfield中fieldLabel去掉冒号,控件label的长度
代码: labelSeparator: '', // 去掉laebl中的冒号 labelWidth: 10,//控件label的长度
- EXTJS 4.2 资料 控件之Grid 行编辑绑定下拉框,并点一次触发一次事件
主要代码: { header: '属性值', dataIndex: 'PropertyValueName', width: 130, editor: new Ext.form.field.ComboB ...
- EXTJS 4.2 资料 控件之Grid 添加行,编辑行,删除行
//SiteVariableConfigValue类,创立一个模型类 Ext.define("SiteVariableConfigValue", { extend: "E ...
- EXTJS 4.2 资料 控件之Window窗体自动填充页面
1.html页面代码: <div id="component" style="width:100%;height:100%"> <body&g ...
随机推荐
- IP地址,子网掩码,默认网关,路由,形象生动阐述
自己的Linux虚拟机已经分配了固定的IP地址(使用无线路由,用的是192.168.1.XX网段),公司的无线网络分配的IP地址是(10.51.174.XX网段) 所以当自己的电脑拿到公司,还想使用桥 ...
- Ehcache(2.9.x) - API Developer Guide, Cache Manager Event Listeners
About CacheManager Event Listeners CacheManager event listeners allow implementers to register callb ...
- django 学习-3 模板变量
1.vim learn/home.html <!DOCTYPE html><html><head> <title>{{title}}< ...
- IOS Delegate & protocal
总结一下: delegate是一个方式,程序组成单元之间分工的一种协调思想 protocal 这个东西不能单独说,要与它相关的两个主要东西一起说,一个是 委托者 通常是VIEW, 一个是被委托者 通常 ...
- Aliyun OSS SDK 异步分块上传导致应用异常退出
问题描述: 使用Aliyun OSS SDK的BeginUploadPart/EndUploadPart执行异步分块上传操作,程序出现错误并异常退出! 原因分析: Using .NET Framewo ...
- Appcn 移动开发 前台与服务器数据交互
第一次写.嘿嘿. 言归正传,这几天开始学习移动开发,使用的是Appcan平台.Appcan平台采用HTML5+CSS3做开发 实现跨平台,正好可以满足我们的业务需求. Appacn和数据库进行交互的方 ...
- ###《VIM实用技巧》
###<VIM实用技巧> #@author: gr #@date: 2015-11-20 #@email: forgerui@gmail.com <VIM实用技巧>阅读笔记. ...
- Cocos2d-x实例:设置背景音乐与音效-HelloWorld场景实现
HelloWorld场景就是游戏中的主菜单场景.HelloWorld.h文件代码如下: #define __HELLOWORLD_SCENE_H__ #include "cocos2d.h& ...
- Wininet笔记一
1, InternetOpen 创建根句柄,由下一层的 InternetOpenUrl 和 InternetConnect 使用,而 InternetConnect 创建的句柄又被之后的几个函数使用. ...
- CSDN 自动评论
转载说明 本篇文章可能已经更新,最新文章请转:http://www.sollyu.com/csdn-auto-reviews/ 说明 当打开http://download.csdn.net/my/do ...