一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

Gird事件機制初級讀本

原文地址 文章日期: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
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技術Gird事件機制初級讀本,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 最近中文字幕无吗免费高清 | 久久综合爱 | 国产精品福利在线观看入口 | 国产91系列 | 久久国产乱子伦精品免费不卡 | 精品国产成人a在线观看 | 97av视频 | 国产成人高清视频 | 日本乱人伦在线观看免费 | 国产一二三在线观看 | 国产欧美亚洲精品 | 一区二区视频在线观看免费的 | 国产伦理久久精品久久久久 | 欧美成人全部费免网站 | 亚洲精品影院久久久久久 | 日本精品久久久 | 欧美成人高清手机在线视频 | bt7086新片速递亚洲最新合集 | 国产精品夜色一区二区三区 | 国产成人精品亚洲一区 | 精品一二三四区 | 在线天堂视频 | 热伊人99re久久精品最新地 | 久久精品久久精品 | 国产swag在线观看 | 草草视频免费在线观看 | 国产精品国产色综合色 | 多人伦交性欧美在线观看 | 91精品在线免费观看 | 超碰97人人射妻 | 欧美xxxx色视频在线观看免费 | 久久riav| 成人免费精品视频 | 色视频www在线播放国产人成 | 四虎新地址4hu 你懂的 | 色欧美在线 | 亚洲美女一区 | 国产一区曰韩二区欧美三区 | 国产成人亚综合91精品首页 | 你懂得2019在线观看网站 | 亚洲图片校园另激情类小说 |