Javascript 力矩列中的触发器函数在GridX中排序

Javascript 力矩列中的触发器函数在GridX中排序,javascript,dojo,dojo.gridx,gridx,Javascript,Dojo,Dojo.gridx,Gridx,我将SingleSort模块与Gridx一起使用。我找不到(我已经检查了SingleSort文档,什么也没找到)对排序事件做出反应的方法。我需要关于哪列(以及如何)排序的信息。我知道如何获取有关排序的信息(getSortData方法),但我不知道如何在进行排序时做出反应。我无法生成onRender事件函数,因为排序后,我会将该信息发送到webapi获取新数据,然后再次渲染网格,以便再次触发事件 define([ "dojo/Evented", "dojo/_base/declare", "doj

我将SingleSort模块与Gridx一起使用。我找不到(我已经检查了SingleSort文档,什么也没找到)对排序事件做出反应的方法。我需要关于哪列(以及如何)排序的信息。我知道如何获取有关排序的信息(getSortData方法),但我不知道如何在进行排序时做出反应。我无法生成onRender事件函数,因为排序后,我会将该信息发送到webapi获取新数据,然后再次渲染网格,以便再次触发事件

define([
"dojo/Evented",
"dojo/_base/declare",
"dojo/store/Memory",
"gridx/core/model/cache/Sync",
"gridx/Grid",
"gridx/modules/ColumnResizer",
'gridx/modules/Focus',
'gridx/modules/RowHeader',
'gridx/modules/select/Row',
'gridx/modules/select/Column',
'gridx/modules/select/Cell',
"gridx/modules/SingleSort"
], function (Evented, declare, Memory, Cache, Grid, ColumnResizer, Focus, RowHeader, SelectRow, SelectColumn, SelectCell, Sort) {
return declare([Evented], {

    _counter: 1,

    _topOffset: 100,

    constructor: function () {
    },

    initialize: function () {
        this._initGrid();
        this._resizeGridContainer();
    },
    clear: function () {
        var store = new Memory({ data: [] });
        this._grid.setStore(store);

        this._counter = 1;
    },
    _initGrid: function () {
        var _this = this;

        var store = new Memory({
            data: []
        });
        var structure = [
            {
                id: 'operationType', field: 'operationType', name: dojo.byId(this._operationTypeId).value                   
            },
            {
                id: 'transportationType', field: 'transportationType', name: dojo.byId(this._transportationUnitTypeId).value
            },
            {
                id: 'transportationTypeLength', field: 'transportationTypeLength', name: dojo.byId(this._transportationLengthId).value
            }              
        ]

        this._grid = Grid({
            id: this._gridId,
            cacheClass: Cache,
            store: store,
            structure: structure,
            modules: [
                ColumnResizer,
                Sort
            ],
            selectRowTriggerOnCell: true
        });
        this._grid.placeAt(this._gridPlaceholderId);
        this._grid.startup();
    },

    _resizeGridContainer: function () {
        var _this = this;
        var container = dojo.byId(this._gridContainerId);
        var height = container.parentElement.clientHeight - this._topOffset;

        require(["dojo/dom-style"], function (domStyle) {
            domStyle.set(_this._gridContainerId, "height", height + "px");
        })
    },
});
});

您需要像这样点击gridx SingleSort模块排序方法

 this._grid.connect( this._grid.Sort, 'sort', function(colId, isDescending, skipUpdateBody){
        alert(colId+" "+isDescending+" "+skipUpdateBody);
    });
每当对网格列进行排序时,这将触发事件。希望这有帮助