1

我正在使用 ag 网格,我想要自定义排序。我正在尝试使用比较器添加自定义排序,但单击列标题时不会调用它。

gridOptions.columnDefs = [
          {
            headerName: this.localeService.getLocaleText("Status"),
            field: "status",
            width: 100,
            param: this,
            cellRenderer: this.deviceStatusRenderer,
            unSortIcon: true,
            suppressSizeToFit: true
          },
          {
            headerName: this.localeService.getLocaleText("IP/Subnet"),
            field: "ip/Subnet",
            filter: "text",
            width: 250,
            unSortIcon: true,
            comparator : this.ipComparator
          },
          {
            headerName: this.localeService.getLocaleText("systemName"),
            field: "systemName",
            width: 159,
            unSortIcon: true,
          }]

方法是

ipComparator(){
    console.log('=================');
    return -1;
  }

我怎样才能调用它

4

0 回答 0