2012-11-19 62 views
1

我有一個dgrid像下面的代碼,我的第二個字段是一個樹,我需要調用XHR時,用戶點擊樹的圖標。我怎樣才能抓住這個事件?列插件(樹)捕捉點擊事件在dojo

感謝

 var CustomGrid = declare([OnDemandGrid, Keyboard, Selection, Pagination]); 

     var grid = new CustomGrid({ 
      columns: [ 
       selector({label: "#", disabled: function(object){ return object.type == 'DOCx'; }}, "radio"), 
       {label:'Id', field:'id', sortable: false}, 
       tree({label: "Title", field:"title", sortable: false, indentWidth:20}), 
       {label:'Count', field:'count', sortable: false} 
      ], 
      store: memoryStore, 
      pagingLinks: false, 
      pagingTextBox: true, 
      firstLastArrows: true, 
      pageSizeOptions: [10, 15, 25], 
      selectionMode: "single", // for Selection; only select a single row at a time 
      cellNavigation: false // for Keyboard; allow only row-level keyboard navigation 
     }, "grid"); 

回答

0

我已經找到了解決方案看道場的代碼。 有一個名爲mouse.jsdgrid/UTIL,那裏你可以找到其他例子像這樣:

enterRow: handler(".dgrid-content .dgrid-row", "mouseover"), 
     enterCell: handler(".dgrid-content .dgrid-cell", "mouseover"), 
     enterHeaderCell: handler(".dgrid-header .dgrid-cell", "mouseover"), 
     leaveRow: handler(".dgrid-content .dgrid-row", "mouseout"), 
     leaveCell: handler(".dgrid-content .dgrid-cell", "mouseout"), 
     leaveHeaderCell: handler(".dgrid-header .dgrid-cell", "mouseout"), 

所以,對於我來說,我剛纔說:

clickCell: handler(".dgrid-content .dgrid-expando-icon", "click"), 
dblclickCell: handler(".dgrid-content .dgrid-cell", "dblclick"), 

現在您可以在Grid_mouseevents.html中測試新事件dgrid/test

關於。