惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
SegmentFault 最新的问题
V
Vulnerabilities – Threatpost
博客园_首页
GbyAI
GbyAI
Martin Fowler
Martin Fowler
S
Secure Thoughts
Help Net Security
Help Net Security
Attack and Defense Labs
Attack and Defense Labs
大猫的无限游戏
大猫的无限游戏
量子位
腾讯CDC
博客园 - 叶小钗
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Microsoft Security Blog
Microsoft Security Blog
Cisco Talos Blog
Cisco Talos Blog
V
V2EX
P
Proofpoint News Feed
T
Tailwind CSS Blog
U
Unit 42
A
Arctic Wolf
PCI Perspectives
PCI Perspectives
B
Blog
F
Fortinet All Blogs
B
Blog RSS Feed
H
Hacker News: Front Page
P
Privacy & Cybersecurity Law Blog
Scott Helme
Scott Helme
G
GRAHAM CLULEY
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
H
Heimdal Security Blog
人人都是产品经理
人人都是产品经理
Forbes - Security
Forbes - Security
TaoSecurity Blog
TaoSecurity Blog
N
Netflix TechBlog - Medium
aimingoo的专栏
aimingoo的专栏
Security Archives - TechRepublic
Security Archives - TechRepublic
Y
Y Combinator Blog
Jina AI
Jina AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Latest news
Latest news
P
Privacy International News Feed
SecWiki News
SecWiki News
L
LINUX DO - 最新话题
M
MIT News - Artificial intelligence
W
WeLiveSecurity
博客园 - 聂微东
T
Tor Project blog
T
Troy Hunt's Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Engineering at Meta
Engineering at Meta

博客园 - 老蒋

[转]silverlight打印慢的问题 Android模拟器访问google网站获取天气信息时,出现 java.net.UnknownHostException: www.google.com 错误 在Eclipse中运行Android程序报 Failed to write core dump. Minidumps are not enabled by default on client versions of Windows 解决方法 在Eclipse中Override基类行为的便捷方式 20110515041233(yyyyMMddHHmmss)时间格式,转换成yyyy-MM-dd HH:mm:ss 未能从程序集 D:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Build.Tasks.dll 加载任务“Microsoft.Build.Tasks.Delete”。 - 老蒋 [javascript]解决IE7的window.close()弹出确认提示框(转) - 老蒋 - 博客园 【转】使用ASP.NET 2.0新增加的SetFocus和MaintainScrollPositionOnPostback增强用户体验 - 老蒋 - 博客园 清除数据库日志文件 (转)按字节长度截取字符串(支持截取带HTML代码样式的字符串) asp.net 导出Excel时,解决纯数字字符串变成类似这样的 2.00908E+18 形式的代码 - 老蒋 此数据库没有有效所有者,因此无法安装数据库关系图支持对象。若要继续,请首先使用“数据库属性”对话框的“文件”页或 ALTER AUTHORIZATION 语句将数据库所有者设置为有效登录名,然后再添加数据库关系图支持对象。 FileUpload控件IIS7上传限制设定方法 - 老蒋 - 博客园 IIS7.0 检测到在集成的托管管道模式下不适用的ASP.NET设置 的解决方法 江西人(一)---简介 使用C#打造自己的mp3播放器(基于Windows Media Player内核) 请教开发WinForm时输入法问题 WebPart使用问题 使用MD5加密注册用户密码的简单示例 - 老蒋 - 博客园
(实战)使用ExtJs+WCF打造分行信息管理功能的一些心得
老蒋 · 2009-03-29 · via 博客园 - 老蒋

转载请注明出处:博客园 老蒋

转换函数如下:

function convertDate(value) {

        return value ? DateToStr(eval("new " + value.substr(1, value.length - 2))) : undefined;

}

b我们需要实现当鼠标移动到数据行时,会显示双击行进行编辑
字样,要实现这个功能,我们需要进行这样的处理:

grid.on("mouseover", function(e, t) {

        var row;

        if ((row = this.getView().findRowIndex(t)) !== false) {


Ext.QuickTips.register({


target: e.target,


text:
'
双击行进行编辑',

autoHide:

true,


hideDelay: 0,


showDelay: 0


})


}


}, grid);

c我们需要在双击某个数据行时,弹出编辑窗口,这个功能实现的代码如下:

//双击记录进行查看或编辑


grid.on(
'rowdblclick', function(grid, rowIndex, e) {

        var selectedKeys = grid.selModel.selections.keys;


EditRecord(selectedKeys);


});


dext-2.0.2版本grid在Firefox里显示过长的内容时,不会像IE一样过长的内容会自动加上;同时还有一个日历控件的在Firefox显示过长的问题。要显示过长的问题,我要需要加上以下这段代码。(日历的解决方法见:http://www.extjs.org.cn/node/219 ,另外的过长问题也是从http://www.extjs.org.cn 找到的解决方法,具体链接不太清楚了。):

//firefox下文本过长自动换行

    if (!Ext.isIE) {


grid.store.on(
'load', function() {


grid.el.select(
"table[class=x-grid3-row-table]").each(function(x) {


x.addClass(
'x-grid3-cell-text-visible');


});


});


}


在页面上的CSS定义如下:

.x-grid3-cell-text-visible .x-grid3-cell-inner


{


overflow:visible;padding:3px 3px 3px 5px;white-space:normal;

}


二、添加功能(编辑窗口与此类似)


添加窗口的效果如下:

在网上看到的FormPanel的示例,都是一列的,现在我们要两列的效果,而且有些行是要跨两列的,还有的我们的例子里,地址类型的有两个字段,在表单里,我们只需要其中一行有字段提示就行了,第二个字段只要有输入框就可以了。

a、
两行的实现

在FormPanel的items里添加一个item,layout方式为column,即两列;然后我们在这个item里添加两个子item,layout方式为form。

b、
跨两列的实现

在FormPanel的items里添加一个item, layout方式为form,然后在添加一个子item,layout方式为form。


c、
在输入框前面不需要显示fieldLabel和那个:号

在这里,我们不能使用hideLabel等于true来实现,如果这样,文本输入框就直接在最左边显示了,跟其它的不对齐,这里我们使用一个变通的方法,就是不设置fieldLabel,但是还有一个问题,有个:号在输入框前面呢,还是没有实现我们的效果,那再加个labelSeparator: ''就可以实现我们的效果了。


d、
其他一些小细节allowBlank: false不能为空, maxLength: 40 可以输入的最大长度 , maxLengthText内容过长时的提示。


三、过滤功能的实现


Ext 2.0.2没有实现列的过滤功能,我们从网上找到了牛人们写的扩展,代码见示例JS目录下的GridFilter文件夹,我们只需要把相关的JS代码在使用的页面引用,并在grid中以插件的方式加到grid里,代码如下:

var filters = new Ext.grid.GridFilters({


filters: [

{ type:

'numeric', dataIndex: 'branch_id' },

{ type:

'string', dataIndex: 'chi_name' },

{ type:

'string', dataIndex: 'eng_name' },

{ type:

'string', dataIndex: 'status' },

{ type:

'numeric', dataIndex: 'area' },

{ type:

'date', dataIndex: 'open_date' },

{ type:

'date', dataIndex: 'close_date' },

{ type:

'string', dataIndex: 'chi_addr_1' },

{ type:

'string', dataIndex: 'phone_no' },

{ type:

'string', dataIndex: 'fax_no' }


]

});

Grid里的代码见下图




四、删除功能


删除功能我们主要是要获取到选中项的id,可以通过grid.selModel.selections.keys来获取


本示例下载:ExtJsSample