angular`ag-grid`自定义比较器RowNode未定义

时间:2018-03-07 19:54:55

标签: angular ag-grid

我的列定义如下:



...
 },
 {
                headerName: 'xyz-header',
                field: 'field1',
                filter: 'set',
                cellRenderer: (params) => this.renderService(params),
                keyCreator: (params) => params.value.label,
                comparator: (label1, label2, node1, node2) => this.compareServices(node1, node2)
 },
 ......
 
function compareServices(node1: RowNode, node2: RowNode): number {
        const li1: ItemVO = node1.data;
        const li2: ItemVO = node2.data;
        let compare = li1.field1.label.localeCompare(li2.field1.label);

        if (compare === 0) {
            compare = li1.revision - li2.revision;
        }

        return compare;
    }

 <ag-grid-angular id="id11" class="ag-strap services-grid" [gridOptions]="gridOptions"
                [rowData]="data.lineItems" (cellValueChanged)="gridValueChanged()" (cellEditingStarted)="setDirty()">
        </ag-grid-angular>
&#13;
&#13;
&#13;

除了RowNodecompareServices函数中未定义之外,其他所有工作都正常。如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

比较器函数签名中缺少一个参数。 $fullStringToEncode = '0100101000000011111010000101010000111101000011010100010000100110'; for ($i = 0; $i < strlen($fullStringToEncode); $i = $i + 8) { $eightBits = substr($fullStringToEncode, $i, 8); $result .= sprintf("%02X", dechex($eightBits)); }