Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ag网格单元在添加“后不编译事件”;angularCompileRows:true;_Angular_Typescript_Ag Grid - Fatal编程技术网

Ag网格单元在添加“后不编译事件”;angularCompileRows:true;

Ag网格单元在添加“后不编译事件”;angularCompileRows:true;,angular,typescript,ag-grid,Angular,Typescript,Ag Grid,我想在ag网格单元中使用路由。我尝试过各种解决方案,比如在gridOption中添加“angularCompileRows:true”,我给了相同的超时时间,但没有一个有效。它给出了“无法读取未定义”错误的属性“$apply” 我的maincomponent.ts文件 private gridOptions: GridOptions; public showGrid: boolean; private columnDefs: any[]; public rowCount: string; pro

我想在ag网格单元中使用路由。我尝试过各种解决方案,比如在gridOption中添加“angularCompileRows:true”,我给了相同的超时时间,但没有一个有效。它给出了“无法读取未定义”错误的属性“$apply”

我的maincomponent.ts文件

private gridOptions: GridOptions;
public showGrid: boolean;
private columnDefs: any[];
public rowCount: string;
properties: ViewPropertyModel[] = []; 

ngAfterViewChecked() {
    this.gridOptions.api.sizeColumnsToFit();
}

ngOnInit() {
    this.gridOptions = <GridOptions>{
        enableColResize: true,
        enableSorting: true,
        enableFilter: true,
        rowModelType: "pagination",
        paginationPageSize: 10,
        angularCompileRows: true
    };

    this.createColumnDefs();
    this.getProperties();
}

constructor(
    public router: Router,
    private service: SharedContents,
    private _propertyServices: PropertyServices) {
    this.service.setData('page-wrapper', true);
}

getProperties() {

        this._propertyServices.getPropertyList()
            .subscribe(properties => {
                var self = this;
                if (properties.status == "success") {
                    this.properties = properties.data;
                    let dataSource = {
                        propertyList: this.properties,
                        rowCount: this.properties.length,
                        getRows: function (params: any) {
                            var lastRow = -1;
                            var pageRows = this.propertyList.slice(params.startRow, params.endRow);
                            if (this.propertyList.length <= params.endRow)
                                lastRow = this.propertyList.length;
                            params.successCallback(pageRows, lastRow);
                        }
                    }
                    this.gridOptions.api.setDatasource(dataSource);
                }
            });
    }

createColumnDefs() {

    this.columnDefs = [
        { headerName: "Property Name", field: "property_name" },

        {
            headerName: "Actions", field: "status",
            cellRenderer: function (params) {
                return "<a [routerLink]='['../editproperty']' title='Edit Property'><i class='md-icon fa fa-edit'></i></a>" +
                    "<a (click)='openArchiveModal()' title= 'Delete' > <i class='md-icon fa fa-trash' > </i></a>";
            }
        }
    ];
}
private gridOptions:gridOptions;
公共显示网格:布尔;
私人专栏:任何[];
公共行数:字符串;
属性:ViewPropertyModel[]=[];
ngAfterViewChecked(){
this.gridOptions.api.sizeColumnsToFit();
}
恩戈尼尼特(){
this.gridOptions={
enableColResize:true,
enableSorting:true,
enableFilter:true,
rowModelType:“分页”,
分页页面大小:10,
angularCompileRows:对
};
这个.createColumnDefs();
这是getProperties();
}
建造师(
公共路由器:路由器,
私人服务:共享内容,
私有财产服务:财产服务){
this.service.setData('page-wrapper',true);
}
getProperties(){
这是.\u propertyServices.getPropertyList()
.订阅(属性=>{
var self=这个;
如果(properties.status==“success”){
this.properties=properties.data;
让数据源={
propertyList:this.properties,
rowCount:this.properties.length,
getRows:函数(参数:任意){
var lastRow=-1;
var pageRows=this.propertyList.slice(params.startRow,params.endRow);
如果(this.propertyList.length

请检查此url,我希望它对您有用。

请检查这个网址,我希望它对你有用

<ag-grid-ng2 #agGrid style="width: 100%; height: 450px;" class="ag-bootstrap"
                                     [gridOptions]="gridOptions"
                                     [columnDefs]="columnDefs"
                                     enableColResize
                                     enableSorting
                                     enableFilter
                                     toolPanelSuppressGroups
                                     toolPanelSuppressValues
                                     debug
                                     rowHeight="35">

                        </ag-grid-ng2>