天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

Gird事件機(jī)制初級(jí)讀本

原文地址 文章日期:2006/09/25/

 新版.32 的YUI-EXT包含了GIRD事件機(jī)制的重要升級(jí)。許多新事件現(xiàn)在可以用了,監(jiān)聽(tīng)事件的機(jī)制也改變了(盡管它仍然向后兼容)。

偵聽(tīng)事件的方法

鑒于 YAHOO.util.CustomEvent只提供簡(jiǎn)單的訪問(wèn),Grid和相關(guān)的對(duì)象擴(kuò)展了新的方法來(lái)偵聽(tīng)事件,這些事件你應(yīng)該是熟悉的。它們是:

  • 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) -移除前先提交的事件偵聽(tīng)
  • on(eventName, fn, scope, override) - addListener 快捷方式

這些方法與YAHOO.uitl.Event一樣,有相同的署名(signatures)。

onRowSelect事件的偵聽(tīng):

var sm = grid.getSelectionModel(); sm.addListener('rowselect', myHandler);

這是GIRD暴露事件的列表和參數(shù)簡(jiǎn)介:

- "this" 指的是Grid對(duì)象; - "e" 指的是 YAHOO.ext.EventObject (常規(guī)化事件對(duì)象) ,除了Drag & Drop對(duì)象是標(biāo)準(zhǔn)瀏覽器事件對(duì)象。- "dd" 指的是Grid的YAHOO.ext.GridDD對(duì)象。

譯注:下面事件解釋以原文方式提供以便讀者準(zhǔn)確理解:

  • 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 = ... // 這里注冊(cè)事件 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
LoadableDataModel (from which XMLDataModel and JSONDataModel are derived) picked up a useful new event:beforeload - Fires right before the model starts fetching remote data. You could use this event combined with the load event to hide/show a loading indicator.
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

JavaScript技術(shù)Gird事件機(jī)制初級(jí)讀本,轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 久久黄色网 | 亚洲伊人成综合人影院 | 亚洲高清在线mv | 夫妻性姿势真人做视频 | 精品免费久久久久久成人影院 | 亚洲精品视频在线播放 | 青娱国产区在线 | 九九精品在线播放 | 在线观看亚洲AV无码每日更新 | 国产在线AV一区二区香蕉 | 欧美一区二区三区激情视频 | 妻子+免费观看完整 | 欧美日韩中文国产一区 | 久久国产精品免费A片蜜芽 久久国产精品萌白酱免费 久久国产精品麻豆AV影视 | 亚洲色婷婷久久精品AV蜜桃久久 | 泡妞高手在都市完整版视频免费 | 国产亚洲精品久久久久小 | 欧美影院在线观看完整版 mp4 | 后入到高潮免费观看 | 毛片网站视频 | 抽插妇女疯狂视频 | 亚洲免费视频观看 | 日本高清免费在线 | 亚洲成A人片在线观看中文不卡 | 嫩小幼处在线 | 国产精品A久久777777 | 亚洲AV无码乱码国产麻豆P | 色中色最新地址登陆 | 日本漫画无彩翼漫画 | 日韩亚洲国产中文字幕欧美 | 成熟YIN荡美妞A片视频麻豆 | 亚洲 自拍 偷拍 另类综合图区 | 1a级毛片免费观看 | 色婷婷国产精品视频一区二区 | 最新国产亚洲亚洲精品视频 | 香蕉久久夜色精品国产小说 | 亚洲AV国产国产久青草 | 国产在线一区观看 | 护士喂我吃乳液我脱她内裤 | 野花日本高清在线观看免费吗 | 国产精品亚洲AV色欲在线观看 |