[英]Problem in showing data in a table for single object in angular
I have a function in angular as:我在 angular 中有一个 function 为:
memberDtos=[];
getDataOfDtoCache(cacheData:any,nameOfCache:String){
console.log(nameOfCache);
this.hasTableClicked=true;
this.memberDtos.push(cacheData);
this.tableName=nameOfCache;
console.log(this.memberDtos);
}
While doing console.log(this.memberDtos);在做 console.log(this.memberDtos); I am getting a single Object as:
我得到一个 Object 为:
GBIM: false
GBI: false
NCHL_T: false
NCHLST: false
NIB_Q: false
NIBL_S: false
P_RQ: false
PES: false
SQ: false
SBL_RES: false
STLME_REQ: false
STL_IME_RES: false
STLIBL_REQ: false
SN_RES: false
STRVU_REQ: false
SU_RES: false
S_REQ: false
STL_RES: false
I want this single object to come in table as:我希望这个单一的 object 出现在表中:
But in html part I used KendoUI as:但在 html 部分我使用 KendoUI 作为:
<kendo-grid
[kendoGridBinding]="memberDtos"
[resizable]="true"
[filterable]="true"
[groupable]="true"
[sortable]="true"
[pageable]="{
buttonCount:4,
pageSizes:[5,10,15]
}"
[pageSize]="5"
*ngIf="hasTableClicked && tableName=='Member DTO'" >
<kendo-grid-column field="memberId" title="Bo Id" width="70">
</kendo-grid-column>
<kendo-grid-column field="memberCode" title="Client Dealer Id" width="100s">
</kendo-grid-column>
</kendo-grid>
But in my UI I got the whole data at single row as:但是在我的用户界面中,我在单行中获得了整个数据:
It is just showing me one single row.I want entire data to come in different rows.Can i get it or not?它只是向我显示一行。我希望整个数据出现在不同的行中。我能得到它吗?
kendoGridBinding
accepts data as an (iterable) array of objects. kendoGridBinding
接受数据作为(可迭代的)对象数组。 You need to transform your data into array of key: value
objects to be able to display the values in different columns as on your image.您需要将数据转换为
key: value
对象的数组,以便能够在图像上的不同列中显示值。
Here's working JSFiddle example of what it should look like这是它应该是什么样子的工作 JSFiddle 示例
Traverse the input data with for in
loop and push the data into memberDtos array as { key: value }
使用
for in
循环遍历输入数据并将数据作为{ key: value }
推送到 memberDtos 数组中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.