原文地址 文章日期:2006/09/25/
新版.32 的YUI-EXT包含了GIRD事件机制的重要升级。许多新事件现在可以用了,监听事件的机制也改变了(尽管它仍然向后兼容)。
侦听事件的方法
鉴于 YAHOO.util.CustomEvent只提供简单的访问,Grid和相关的对象扩展了新的方法来侦听事件,这些事件你应该是熟悉的。它们是:
- addListener(eventName, fn, scope, override) - "eventName" should be one of the events defined below. "fn" is the function to call when the event occurs. "scope" is an optional object providing the scope (this) of the function. "override" is whether or not to apply that scope and is only there for backwards compatibility.
- removeListener(eventName, fn, scope) -移除前先提交的事件侦听
- on(eventName, fn, scope, override) - addListener 快捷方式
这些方法与YAHOO.uitl.Event一样,有相同的署名(signatures)。
onRowSelect事件的侦听:
var sm = grid.getSelectionModel(); sm.addListener('rowselect', myHandler);
这是GIRD暴露事件的列表和参数简介:
- "this" 指的是Grid对象; - "e" 指的是 YAHOO.ext.EventObject (常规化事件对象) ,除了Drag & Drop对象是标准浏览器事件对象。 - "dd" 指的是Grid的YAHOO.ext.GridDD对象。译注:下面事件解释以原文方式提供以便读者准确理解:
- cellclick - (this, rowIndex, columnIndex, e) - Fires when a cell is clicked
- celldblclick - (this, rowIndex, columnIndex, e) - Fires when a cell is double clicked
- rowclick - (this, rowIndex, e) - Fires when a row is clicked
- rowdblclick - (this, rowIndex, e) - Fires when a row is double clicked
- headerclick - (this, columnIndex, e) - Fires when a header is clicked
- rowcontextmenu - (this, rowIndex, e) - Fires when a row is right clicked
- headercontextmenu - (this, columnIndex, e) - Fires when a header is right clicked
- beforeedit - (this, rowIndex, columnIndex, e) - Fires just before editing is started on a cell
- afteredit - (this, rowIndex, columnIndex, e) - Fires immediately after a cell is edited
- bodyscroll - (scrollLeft, scrollTop) - Fires when the grid's body is scrolled
- columnresize - (columnIndex, newSize) Fires when the user resizes a column.
- startdrag - (this, dd, e) - Fires when row(s) start being dragged
- enddrag - (this, dd, e) - Fires when a drag operation is complete
- dragdrop - (this, dd, targetId, e) - Fires when dragged row(s) are dropped on a valid DD target
- dragover - (this, dd, targetId, e) Fires while row(s) are being dragged. "targetId" is the id of the Yahoo.util.DD object the selected rows are being dragged over.
- dragenter - (this, dd, targetId, e) - Fires when the dragged row(s) first cross another DD target while being dragged
- dragout - (this, dd, targetId, e) - Fires when the dragged row(s) leave another DD target while being dragged
Gird事件的例子
function onCellClick(grid, rowIndex, colIndex, e){ alert('Cell at row ' + rowIndex + ', column ' + colIndex + ' was clicked!'); } var grid = ... // 这里注册事件 grid.addListener('cellclick', onCellClick);
普通Grid事件 Since there is no way to envision everything you may want to do with the grid, I've also exposed direct access to many of the grid's raw events. All of these events pass one parameter to their handler: "e" a YAHOO.ext.EventObject.
- click
- dblclick
- mousedown
- mouseup
- mouseover
- mouseout
- keypress
- keydown
var img = getEl('loading-indicator'); var dm = grid.getDataModel(); dm.addListener('beforeload', img.show, img, true); dm.addListener('load', img.hide, img, true);Hopefully this can get you started with the new event system. If you have any questions, feel free to post in the Help Forum and I will help you out. Jack
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
暂无评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
2024年11月30日
2024年11月30日
- 群星《人声1号[十大发烧情歌]》2CD[WAV分轨]
- 《郁可唯所有歌曲合集》[FLAC/MP3][6.2G]
- 郑秀文《SOUND OF MI》2024 7月新专辑[FLAC/MP3][1.1G]
- 费玉清《费玉清精粹》[FLAC][1G]
- 黑豹乐队-至爱极品顶级享受《豹行天下3CD》[WAV分轨]
- 音响系统测试碟《AbsoluteSamplerOnTheFly》[WAV+CUE]
- 一流的爵士乐《FirstClassJazz》ArtBlakey[正版原抓WAV+CUE]
- 杨千嬅《狼来了》[DSF][1.2G]
- 车载《旧情绵绵一路伴随》80后经典[FLAC/MP3][1G]
- 刀郎《身披彩衣的姑娘》[FLAC][1.4G]
- 张国荣《MissYouMix》美压版[正版原抓WAV+CUE]
- 长笛和吉他的浪漫音乐《OriginalRomanticMusicforFluteandGuitar》[WAV+CUE]
- 窦唯《八段锦》(上海音像)[WAV+CUE]
- DJ动力100%《堵在路上的解闷high曲》[FLAC/MP3][948M]
- 节奏炸裂《抖音最嗨 DJ 舞曲大合集》[FLAC/MP3][2G]