[size=large][color=red]1.Grid [/color][/size]
********************************************************************************************
[color=cyan]初始化时添加[/color]
[color=blue]1、双击 [/color]
var cb = new Ext.grid.RowSelectionModel({
singleSelect:true //如果值是false,表明可以选择多行;否则只能选择一行
});
var alarmGrid = new Ext.grid.GridPanel({
}
alarmGrid.addListener('rowdblclick', rowdblclickFn);
function rowdblclickFn(grid, rowindex, e){
grid.getSelectionModel().each(function(rec){
alert(rec.get(fieldName)); //fieldName,记录中的字段名
});
}
[color=blue]2、单击 [/color]
var cb = new Ext.grid.RowSelectionModel({
singleSelect:true //如果值是false,表明可以选择多行;否则只能选择一行
});
var alarmGrid = new Ext.grid.GridPanel({
}
alarmGrid.addListener('rowclick', rowclickFn);
function rowclickFn(grid, rowindex, e){
grid.getSelectionModel().each(function(rec){
alert(rec.get(fieldName)); //fieldName,记录中的字段名
});
}
=========================================================================================
[color=violet]初始化配置[/color]
var cb = new Ext.grid.RowSelectionModel({
singleSelect:true //如果值是false,表明可以选择多行;否则只能选择一行
});
var alarmGrid = new Ext.grid.GridPanel({
}
alarmGrid.addListener('rowclick', rowclickFn);
function rowclickFn(grid, rowindex, e){
grid.getSelectionModel().each(function(rec){
alert(rec.get(fieldName)); //fieldName,记录中的字段名
});
}
var grid = new Ext.grid.GridPanel({
store: <your datastore>,
columns:[<your columns>],
renderTo:'example-grid',
height:200,
listeners:{
[color=blue]//单击 [/color]
rowdblclick : function(grid,row){
alert("rowdblclick")
},
[color=blue]//双击 [/color]
rowclick:function(grid,row){
alert('rowclick')
}
}
});
====================================================================================================================
[color=red]tree[/color]
treepanel叶子节点,增加一个tabpanel,treepanel添加双击事件
{
xtype:'treepanel',
//.....
listeners: {
'dblclick':function(node,e){
//增加tabpanel
}
}
}
============================================================================================
[color=red]ext textfiled[/color]
添加双击事件
遇到一个对textfiled 双击事件进行监听的需求 原先采取的是失去焦点事件(ext的api中不包含双击事件),可是对于修改textfiled的内容却无法忍受,所以折腾了一下午想出个最蠢的办法 我不会去怎么注册事件然后有怎么使用监听的,下面是我的方法
var testTextFiled = new Ext.form.TextField({
fieldLabel: 'test,
name: 'test,
labelSeparator: ':',
width: 227,
height: 25,
allowBlank:false
})
其实大家都可以用firedug可以看到对于的 窗口页面里所有对象的信息的 其实全都是html
下面我们来组成事件
registerEventToTextFile:function(){
document.getElementById(testTextFiled .getId()).οndblclick=function(){
alert('文本输入框的双击事件!');
}
}
这段必须是在页面构造完成以后才能去调用 要不会提示document.getElementById(testTextFiled .getId()).为空 这大家是可以理解的
完成对testTextFiled 对象注册了输入框的双击事件了
=============================================================================================================
********************************************************************************************
[color=cyan]初始化时添加[/color]
[color=blue]1、双击 [/color]
var cb = new Ext.grid.RowSelectionModel({
singleSelect:true //如果值是false,表明可以选择多行;否则只能选择一行
});
var alarmGrid = new Ext.grid.GridPanel({
}
alarmGrid.addListener('rowdblclick', rowdblclickFn);
function rowdblclickFn(grid, rowindex, e){
grid.getSelectionModel().each(function(rec){
alert(rec.get(fieldName)); //fieldName,记录中的字段名
});
}
[color=blue]2、单击 [/color]
var cb = new Ext.grid.RowSelectionModel({
singleSelect:true //如果值是false,表明可以选择多行;否则只能选择一行
});
var alarmGrid = new Ext.grid.GridPanel({
}
alarmGrid.addListener('rowclick', rowclickFn);
function rowclickFn(grid, rowindex, e){
grid.getSelectionModel().each(function(rec){
alert(rec.get(fieldName)); //fieldName,记录中的字段名
});
}
=========================================================================================
[color=violet]初始化配置[/color]
var cb = new Ext.grid.RowSelectionModel({
singleSelect:true //如果值是false,表明可以选择多行;否则只能选择一行
});
var alarmGrid = new Ext.grid.GridPanel({
}
alarmGrid.addListener('rowclick', rowclickFn);
function rowclickFn(grid, rowindex, e){
grid.getSelectionModel().each(function(rec){
alert(rec.get(fieldName)); //fieldName,记录中的字段名
});
}
var grid = new Ext.grid.GridPanel({
store: <your datastore>,
columns:[<your columns>],
renderTo:'example-grid',
height:200,
listeners:{
[color=blue]//单击 [/color]
rowdblclick : function(grid,row){
alert("rowdblclick")
},
[color=blue]//双击 [/color]
rowclick:function(grid,row){
alert('rowclick')
}
}
});
====================================================================================================================
[color=red]tree[/color]
treepanel叶子节点,增加一个tabpanel,treepanel添加双击事件
{
xtype:'treepanel',
//.....
listeners: {
'dblclick':function(node,e){
//增加tabpanel
}
}
}
============================================================================================
[color=red]ext textfiled[/color]
添加双击事件
遇到一个对textfiled 双击事件进行监听的需求 原先采取的是失去焦点事件(ext的api中不包含双击事件),可是对于修改textfiled的内容却无法忍受,所以折腾了一下午想出个最蠢的办法 我不会去怎么注册事件然后有怎么使用监听的,下面是我的方法
var testTextFiled = new Ext.form.TextField({
fieldLabel: 'test,
name: 'test,
labelSeparator: ':',
width: 227,
height: 25,
allowBlank:false
})
其实大家都可以用firedug可以看到对于的 窗口页面里所有对象的信息的 其实全都是html
下面我们来组成事件
registerEventToTextFile:function(){
document.getElementById(testTextFiled .getId()).οndblclick=function(){
alert('文本输入框的双击事件!');
}
}
这段必须是在页面构造完成以后才能去调用 要不会提示document.getElementById(testTextFiled .getId()).为空 这大家是可以理解的
完成对testTextFiled 对象注册了输入框的双击事件了
=============================================================================================================