Ag grid &引用;没有要显示的行";消息来自服务的数据绑定之后
“没有要显示的行”消息显示在网格中,但网格显示一行数据 我有一个demoComponent.ts和html文件。 请参考我下面的代码 demoComponent.tsAg grid &引用;没有要显示的行";消息来自服务的数据绑定之后,ag-grid,Ag Grid,“没有要显示的行”消息显示在网格中,但网格显示一行数据 我有一个demoComponent.ts和html文件。 请参考我下面的代码 demoComponent.ts import { GridOptions } from "ag-grid/main"; import { Service } from '../Services/service'; @Component({ . templateUrl: 'demoComponent.html', . }) @Inject
import { GridOptions } from "ag-grid/main";
import { Service } from '../Services/service';
@Component({
.
templateUrl: 'demoComponent.html',
.
})
@Injectable()
export class demoComponent implements OnInit {
GridOptions: GridOptions;
GridColumnDefs: any[];
GridData: any[];
data1 : any[]
constructor(private Service: Servicee) {
}
ngOnInit() {
this.GridOptions = <GridOptions>{
enableFilter: false,
rowSelection: 'multiple',
enableSorting: true,
enableColResize: true,
singleClickEdit: true,
animateRows: true,
headerHeight: 50,
rowClass: 'rowClass'
};
Observable.forkJoin(
this.Service.methed1(this.id),
this.Service.methed1(this.id),
this.Service.methed1(this.id),
this.Service.methed1()
).subscribe(response => {
this.data1 = <any>response[0];
this.data2 = <any>response[1];
this.data3 = <any>response[2];
this.data4 = <any>response[3];
this.GridBind()
});
}
GridBind()
{
this.GridColumnDefs = [
{ headerName: "", field: "id", hide: true },
{ headerName: "Column1", field: "Column1", width: 70, editable: true, tooltipField: "release", headerTooltip: "Release" },
{ headerName: "Column2", field: "Column2", width: 80, editable: true, tooltipField: "Column2", headerTooltip: "Column2",
//cellEditorFramework: EstimatingSourceComponent
cellEditorFramework: EstimatingSourceComponent,
cellEditorParams: {
dropDownValue: this.data1,
}
},
{ headerName: "Column3", field: "Column3", width: 70, editable: true },
{ headerName: "Column4", field: "Column4", width: 70, editable: true },
];
this.GridData = [
{
id: 1, Column1: this.data1.value1, Column2: this.data1.value2, Column3: this.data1.value3, Column4: this.data1.value4
}
];
}
}
从“ag grid/main”导入{GridOptions};
从“../Services/Service”导入{Service};
@组成部分({
.
templateUrl:'demoComponent.html',
.
})
@可注射()
导出类demoComponent实现OnInit{
GridOptions:GridOptions;
GridColumnDefs:任何[];
GridData:任何[];
数据1:任何[]
构造函数(专用服务:Servicee){
}
ngOnInit(){
this.GridOptions={
enableFilter:错误,
行选择:“多个”,
enableSorting:true,
enableColResize:true,
singleClickEdit:true,
动画师:没错,
人头数:50,
rowClass:“rowClass”
};
可观察的分叉连接(
this.Service.method1(this.id),
this.Service.method1(this.id),
this.Service.method1(this.id),
this.Service.methed1()
).订阅(响应=>{
this.data1=响应[0];
this.data2=响应[1];
this.data3=响应[2];
this.data4=响应[3];
这个文件名为.GridBind()
});
}
网格绑定()
{
this.GridColumnDefs=[
{headerName:,字段:“id”,隐藏:true},
{headerName:“Column1”,字段:“Column1”,宽度:70,可编辑:true,工具提示字段:“release”,headerTooltip:“release”},
{headerName:“Column2”,字段:“Column2”,宽度:80,可编辑:true,工具提示字段:“Column2”,headerTooltip:“Column2”,
//cellEditorFramework:估计SourceComponent
cellEditorFramework:估计SourceComponent,
cellEditorParams:{
dropDownValue:this.data1,
}
},
{headerName:“Column3”,字段:“Column3”,宽度:70,可编辑:true},
{headerName:“Column4”,字段:“Column4”,宽度:70,可编辑:true},
];
this.GridData=[
{
id:1,第1列:this.data1.value1,第2列:this.data1.value2,第3列:this.data1.value3,第4列:this.data1.value4
}
];
}
}
然后是demoComponent.html
<ag-grid-angular style="width: 100%; height: 350px;"
id="grid1"
class="ag-fresh"
[rowData]="GridData"
[columnDefs]="GridColumnDefs"
[gridOptions]="GridOptions">
</ag-grid-angular>
渲染时,一行与网格绑定。但是“没有要显示的行”正在显示
请纠正我的执行,如果它是错误的
提前谢谢