【问题标题】:Column Plugins(tree) Catch click event in dojoColumn Plugins(tree) 在dojo中捕捉点击事件
【发布时间】:2012-11-19 11:21:09
【问题描述】:

我有一个类似以下代码的 dgrid,我的第二个字段是树,当用户单击树的图标时,我需要调用 XHR。我怎样才能赶上这个事件?

谢谢

        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"); 

【问题讨论】:

    标签: javascript dojo mouseevent dgrid


    【解决方案1】:

    我通过查看 dojo 的代码找到了解决方案。 dgrid/util 中有一个名为 mouse.js 的文件,您可以在其中找到其他类似的示例:

    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"),
    

    现在您可以在 dgrid/test 中测试 Grid_mouseevents.html 中的新事件。

    问候。

    【讨论】:

      猜你喜欢
      • 2019-08-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-03
      相关资源
      最近更新 更多