/** hzm modify
* method: Ext.panel.Table.hasLockedColumns: function(columns) {}
* function:支持extjs grid colums三元表达式,tbar支持三元表示
eg: user.users_type == 2 ? {text: "创建日期", flex: 1, dataIndex: 'create_time'} : null,
var grid = Ext.create('Ext.grid.Panel', {
columns: [
new Ext.grid.RowNumberer(),
user.users_type == 1 ? {text: "创建日期", flex: 1, dataIndex: 'create_time'} : null,
{text: "备注", flex: 1, sortable: true, dataIndex: 'remark'}
]
}); user.users_type == 1 ? {
text:'添加会员',
iconCls:'add',
handler:function() {
MyDesktop.MemberWindow.member.addOrUpdateMember();
}
} : null,
user.users_type == 1 ? '-' : null
* note: 添加if判断column是否为空 //源代码:
if (!column.processed && column.locked) {
return true;
}
*/
Ext.override(Ext.panel.Table, {
hasLockedColumns: function(columns) {
var i,
len,
column; if (Ext.isObject(columns)) {
columns = columns.items;
}
for (i = 0, len = columns.length; i < len; i++) {
column = columns[i]; if (column && !column.processed && column.locked) {
return true;
}
}
}
}); /**
* hzm modify
* method: Ext.data.Connection.onComplete : function(request, xdrResult)
* function: gridpanel数据加载出错时(服务器内部错误),支持返回错误原因
*/
Ext.override(Ext.data.Connection, {
onComplete : function(request, xdrResult) {
var me = this,
options = request.options,
result,
success,
response; try {
result = me.parseStatus(request.xhr.status);
} catch (e) {
// in some browsers we can't access the status if the readyState is not 4, so the request has failed
result = {
success : false,
isException : false
}; }
success = me.isXdr ? xdrResult : result.success; if (success) {
response = me.createResponse(request);
me.fireEvent('requestcomplete', me, response, options);
Ext.callback(options.success, options.scope, [response, options]);
/**
* hzm modify start
* method: Ext.data.Connection.onComplete : function(request, xdrResult)
* function: gridpanel数据加载出错时(服务器内部错误),支持返回错误原因
* note: 原生系统,无以下段代码
*/
if(response && options.operation && !options.operation.response) {
options.operation.response = response;
}
/*
* modify end
*/
} else {
if (result.isException || request.aborted || request.timedout) {
response = me.createException(request);
} else {
response = me.createResponse(request);
}
me.fireEvent('requestexception', me, response, options);
Ext.callback(options.failure, options.scope, [response, options]);
} Ext.callback(options.callback, options.scope, [options, success, response]);
delete me.requests[request.id];
return response;
}
}); /**
* hzm modify
* method: Ext.selection.Model.getSelection : function()
* function: 当修改并reload后未更新当前grid selected range中的record
*/
Ext.override(Ext.selection.Model, {
getSelection: function() {
var me = this,
store = me.store,
arr = this.selected.getRange(); for(var i = 0; arr && i < arr.length; i++) {
try {
var record = arr[i];
var newRecord = store.getById(record.get(record.idProperty));
if(newRecord) {
arr[i] = newRecord;
}
} catch(e) {
alert('ext_override getSelection出现异常,详细信息:' + e);
}
}
return arr;
}
});

最新文章

  1. C段渗透+cain嗅探
  2. 在Ubuntu下使用 csapp.h 和 csapp.c
  3. 【Win10】在应用中使用 SQLite 数据库
  4. 序列化LinkedHashMap,有序输出Json字符串
  5. 安装交叉编译arm-linux-gcc环境
  6. NumberBox( 数值输入框) 组件
  7. 在 Sublime Text 3 中快捷打开 git-gui
  8. libconfig第一篇———使用指南
  9. android 下 利用webview实现浏览器功能
  10. win10 uwp 从StorageFile获取文件大小
  11. spring的aop详解
  12. 服务端预渲染之Nuxt(爬坑篇)
  13. Windows Server 2008 R2提示api-ms-win-crt-runtime-l1-1-0.dll 丢失解决方法
  14. 基于WanAndroid开放API实现的文章阅读APP
  15. 【Java】-NO.16.EBook.4.Java.1.010-【疯狂Java讲义第3版 李刚】- 异常
  16. 【搜索】棋盘问题(DFS)
  17. Timeout in android httpclient
  18. MapReduce-朴素贝叶斯
  19. PCA人脸识别的python实现
  20. AngularJs:Directive指令用法

热门文章

  1. 使用R语言 SDK调取tushare数据
  2. Petrozavodsk Summer-2016. Warsaw U Contest, XVI Open Cup Onsite.
  3. FTP、SFTP、SCP、SSH、OpenSSH关系解密
  4. gerp 用法
  5. 使用OCCI操作Oracle数据库写入中文乱码
  6. leetcood学习笔记-38-报数
  7. 分析post与json
  8. duilib教程之duilib入门简明教程17.事件处理和消息响应
  9. PHP实现对短信验证码发送次数的限制
  10. WinDBG常用断点命令