質問

I have a dgrid like following code, my second field is a Tree, I need call a XHR when user to click tree's icon. How can I catch this event?

Thanks

        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"); 
役に立ちましたか?

解決

I have found the solution looking at the dojo's code. There is a file called mouse.js in dgrid/util, there you can find others examples like these:

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

So, for my case I have just added:

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

Now you can test the new events in Grid_mouseevents.html in dgrid/test.

regards.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top