您的位置:首页 > Web前端 > JavaScript

Extjs 学习笔记

2014-08-29 00:00 197 查看
摘要: Extjs 学习笔记

学习和使用Extjs已经有一段时间了,之间遇到了一些问题,并解决了,故作此文已记之。

1.如果window没有显示,可能是因为没有设置window的width height x y

2.如果某一个容器没有显示,可能是因为width和height设置的不对,(比如其他容器太大了,被覆盖了)

3.容器可以用collapsible:true,来显示收缩/展开按钮

4.用textfield中的value属性,可以给其设置默认值。

5.renderer主要使用与 gridpanel中的某一列,显示与值相对应的含义。例如值为false,



renderer: function(value){
if(value=='1'){
return '男';
}else if(value=='2'){
return '女';
}else{
return '未知';
}
}


6.滚动显示信息

region:'south',
xtype:'label',
style: 'font-size:18px;font-family: 隶书;color:red;text-align:center;',
height: 18,
name:'status',
animate:true,
listeners:{
render:function(){
count=0;
var task = {
run:function(){
var message=['青岛黄岛暴雨预警','市南区山东路发生重大交通事故','崂山区世园会附近发生严重拥堵'];
count=count+1;
if(count>=3)
count= count%3;
Ext.ComponentQuery.query('monMain label[name=status]')[0].setText(message[count]);
},
interval:3000,
animate:true
};
var runner = new Ext.util.TaskRunner();
runner.start(task);
}
}


7.Extjs 中的isKindOf

这里我们先回顾一下Java的isKindOf和isMemberOf。

isKindOf:class 表示:对象是否为class或其父类
isMemberOf:class 表示:对象是否为class
class Person{
}
class Employee extends Person{
}

public void testApp()
{
Person p = new Person();
Employee e = new Employee();
System.out.println(e instanceof Employee);// isKindOf true
System.out.println(p.getClass().getName().
equals(e.getClass().getName()));//isMemberOf false
}


在Extjs中,我暂时只找到了isKindOf的判断方法:isXType

var tabView = Ext.ComponentQuery.query(view)[0];
if(tabView.isXType('gridpanel')){
tabView.getStore().load();
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Extjs 学习笔记