2016-12-01 13 views
0

detailInit関数で剣道グリッドを作成しようとしていますが、実装方法がわかりませんでした。ユーザーが詳細を表示するために切り替えることが可能となり、下記の指名手配出力のサンプルがあり、私のグリッドdetailsInit関数のアドレス[オブジェクト、オブジェクト]のデータ表示する方法剣道グリッドの作成方法detailInit

: -

電流出力を:

Name  | Phone   |  
-------------------------------- 
John Smith | (519) 420-2391 | 
-------------------------------- 
^ Location | no    | 
    ----------------------------- 
    london | 123   | 
    aus  | 456   | 

var peoples = [], 
 
    address = []; 
 

 

 
peoples = [{ 
 
    id: 1, 
 
    name: "John Smith", 
 
    phone: "(519) 420-2391", 
 
    address: [{ 
 
    Location: "london", 
 
    no: "123" 
 
    }, { 
 
    Location: "aus", 
 
    no: "456" 
 
    }] 
 
}, { 
 
    id: 2, 
 
    name: "James Seth", 
 
    phone: "(123) 212-3332", 
 
    address: [{ 
 
    Location: "Paris", 
 
    no: "789" 
 
    }, { 
 
    Location: "ita", 
 
    no: "888" 
 
    }] 
 
}]; 
 

 
$("#grid").kendoGrid({ 
 
    dataSource: { 
 
    data: peoples, 
 

 
    }, 
 

 
    columns: [{ 
 
    field: "name", 
 
    title: "Name" 
 
    }, { 
 
    field: "phone", 
 
    title: "Phone number" 
 
    }, { 
 
    field: "address", 
 
    title: "Address" 
 
    }], 
 

 
});
<!DOCTYPE html> 
 
<html> 
 

 
<head> 
 
    <meta charset="utf-8"> 
 
    <title>Untitled</title> 
 

 
    <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2016.2.714/styles/kendo.common.min.css"> 
 
    <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2016.2.714/styles/kendo.rtl.min.css"> 
 
    <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2016.2.714/styles/kendo.default.min.css"> 
 
    <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2016.2.714/styles/kendo.mobile.all.min.css"> 
 

 
    <script src="http://code.jquery.com/jquery-1.12.3.min.js"></script> 
 
    <script src="http://kendo.cdn.telerik.com/2016.2.714/js/angular.min.js"></script> 
 
    <script src="http://kendo.cdn.telerik.com/2016.2.714/js/jszip.min.js"></script> 
 
    <script src="http://kendo.cdn.telerik.com/2016.2.714/js/kendo.all.min.js"></script> 
 
</head> 
 

 
<body> 
 
    <div id="example"> 
 
    <div id="grid"></div> 
 
    </div> 
 

 
</body> 
 

 
</html>
Name  | Phone   |  Address 
------------------------------------------------ 
John Smith | (519) 420-2391 | [object Object] 
------------------------------------------------ 
James Seth | (123) 212-3332 | [object Object] 

は出力を望んでいました

答えて

0

それはデータだとしてだけで現在の行のaddressプロパティを使用してdetailInitイベントで別のグリッドを作成します。これを行う方法の

detailInit: function(e) { 
    $('<div></div>') 
     .appendTo($(e.detailRow)) 
     .kendoGrid({ 
      dataSource: { 
       data: e.data.address 
      }, 
      columns: [{ 
       field: "Location" 
      }, { 
       field: "no" 
      }] 
     }); 
} 

Official demoを。

関連する問題