折叠所有kendoGridDetailTemplates在过滤器上单击角度2中的KendoUI网格

时间:2017-11-09 06:29:50

标签: angular kendo-ui kendo-grid collapse

这是我在点击时折叠细节网格的功能。相同的函数将调用过滤器单击以检查是否有任何细节网格打开。如果打开则应该隐藏细节网格。此功能在单击时正常工作,但在单击减号按钮时不能正常工作。当从其他组件应用过滤器按钮时,它不起作用。

IN GRIDVIEW.COMPONENT.TS

public OnMasterRowCollapse(dataItem: any): any {
        //if (dataItem.index != null) {
            let firstColumn: HTMLElement = null;
            firstColumn = this.GetFirstColumnOfMasterRow(dataItem.index);
            firstColumn.classList.remove('border_left_blue');
}
private GetFirstColumnOfMasterRow(rowIndex: number): any {
        let gridMasterRows: any = null;
        let gridMasterRowFirstColumn: HTMLElement = null;

        gridMasterRows = document.getElementsByClassName('k-master-row gridRow');

        if (gridMasterRows != null && gridMasterRows.length > 0) {
            gridMasterRowFirstColumn = (<HTMLElement>gridMasterRows[rowIndex].firstElementChild);
        }

        return gridMasterRowFirstColumn;
    }

IN dashboard.component.ts

public onQAFilterClicked(): void {
        //this.advanceSearchDataContext = {};
        if (this.qaClicked) {
            this.advanceSearchDataContext.Status = "QA";
            this.qaClicked = false;
            this.kcClicked = true;
            this.putawayClicked = true;
        }
        else {
            this.advanceSearchDataContext.Status = "";
            this.qaClicked = true;
        }
        this.GetDataSource();

        let row = this.dataSource;
        var rowlist = {};
        if (row && row.length > 0) {
            for (var i = 0; i < row.length; i++) {
                rowlist['dataItem'] = row[i];
                rowlist['index'] = i;

                if (rowlist) {
                  //this will call a function in gridview.component.ts
                    this.gridViewComponent.OnMasterRowCollapse(rowlist);
                }
            }
        }

        console.log("clicked");
        console.log(this.advanceSearchDataContext);
}

我在两个调用的gridview.component.ts中的OnMasterRowCollapse中的dataItem中提供相同的输入。两个电话都发生了同样的事情。但是在应用过滤器时,细节网格没有关闭。

我无法弄清楚这段代码有什么问题。

0 个答案:

没有答案