簡體   English   中英

顯示帶有JSON對象嵌套數組的ng-grid?

[英]Display ng-grid with nested array of JSON objects?

我有一些看起來像這樣的JSON數據:

return {
    "activityTypes" :[{
        "id" :"",
        "name:" :"",
        "icon" : "",
        "partial": "",
        "label" : {
            "id": "",
            "name": ""
        }
    }],
    "apiKey" : "",
    "approveBy": 0,
    "approvers" : [], 
    "canSendTo" : [{
        "id" : "",
        "name" : ""
    }],  
    "creators" : [],
    "isActive" : false,
    "notification" : false, 
    "sourceId": "",
    "sourceName":""
};

我正在嘗試使用ng-grid,但是在嘗試訪問對象數組(例如activityTypescanSendTo數組)內的元素時遇到了麻煩。 在下面的示例中,我嘗試顯示canSendTo的ID。 我嘗試了以下方法,但它無法在屏幕上呈現。 有想法該怎么解決這個嗎? 謝謝!

{field: 'canSendTo.id', displayName: 'Can Send To', width:'10%',
    cellTemplate: '<div class="ngCellText", style="white-space: normal;">{{row.getProperty(col.field)}}</div>'},

我對ng-grid一無所知,但是從直接的javascript角度來看,它應該是canSendTo [0] .id,因為canSendTo是一個單元素數組。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM