1

我有一个类似于以下代码的 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"); 
4

1 回答 1

0

我找到了查看 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中测试新事件。

问候。

于 2012-11-20T12:39:47.177 回答