OSS で利用できる機能
ツリー - AngularJS との連携
このサンプルは CTP 機能を使用しています。製品版では、API や動作が変更される場合があります。
このサンプルは、より大きい画面サイズのためにデザインされました。
モバイル デバイスで画面を回転、フル サイズ表示、またはその他のデバイスにメールで送信します。
このサンプルは、AngularJS ディレクティブを使用してツリーを作成する方法を紹介します。
コード ビュー
クリップボードへコピー
<!DOCTYPE html> <html> <head> <title></title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Ignite UI for jQuery Required Combined CSS Files --> <link href="http://cdn-na.infragistics.com/igniteui/2024.1/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" /> <link href="http://cdn-na.infragistics.com/igniteui/2024.1/latest/css/structure/infragistics.css" rel="stylesheet" /> <script src="http://ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.8.3.js"></script> <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> <script src="http://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script> <script src="/js/angular.min.js"></script> <!-- Ignite UI for jQuery Required Combined JavaScript Files --> <script src="http://cdn-na.infragistics.com/igniteui/2024.1/latest/js/infragistics.core.js"></script> <script src="http://cdn-na.infragistics.com/igniteui/2024.1/latest/js/infragistics.lob.js"></script> <script src="http://cdn-na.infragistics.com/igniteui/2024.1/latest/js/extensions/igniteui-angularjs.js"></script> <script src="/data-files/hierarchical-files.js"></script> <script type="text/javascript"> var sampleApp = angular.module('sampleApp', ['igniteui-directives']); sampleApp.controller('treeController', function ($scope) { $scope.data = files; }); </script> </head> <body> <div ng-app="sampleApp" ng-controller="treeController"> <ig-tree id="tree1" data-source="data"> <bindings child-data-property="Folder" text-key="Text" value-key="Value"> </bindings> </ig-tree> </div> </body> </html>
var files = [ { Text: "コンピューター", Value: "Folder", ImageUrl: "../../images/samples/tree/computer.png", Folder: [ { Text: "ミュージック", Value: "Folder", ImageUrl: "../../images/samples/tree/book.png", Folder: [ { Text: "イングウェイ・マルムスティーン", Value: "Folder", ImageUrl: "../../images/samples/tree/book.png", Folder: [{ Text: "イングウェイ・マルムスティーン - Making Love", Value: "File", ImageUrl: "../../images/samples/tree/music.png", Folder: "" }, { Text: "イングウェイ・マルムスティーン - Rising Force", Value: "File", ImageUrl: "../../images/samples/tree/music.png", Folder: "" }, { Text: "イングウェイ・マルムスティーン - Fire and Ice", Value: "File", ImageUrl: "../../images/samples/tree/music.png", Folder: "" } ] }, { Text: "ホワイトスネーク", Value: "Folder", ImageUrl: "../../images/samples/tree/book.png", Folder: [ { Text: "ホワイトスネーク - Trouble", Value: "File", ImageUrl: "../../images/samples/tree/music.png", Folder: "" }, { Text: "ホワイトスネーク - Bad Boys", Value: "File", ImageUrl: "../../images/samples/tree/music.png", Folder: "" }, { Text: "ホワイトスネーク - Is This Love", Value: "File", ImageUrl: "../../images/samples/tree/music.png", Folder: "" } ] }, { Text: "AC/DC", Value: "Folder", ImageUrl: "../../images/samples/tree/book.png", Folder: [ { Text: "AC/DC - ThunderStruck", Value: "File", ImageUrl: "../../images/samples/tree/music.png", Folder: "" }, { Text: "AC/DC - T.N.T.", Value: "File", ImageUrl: "../../images/samples/tree/music.png", Folder: "" }, { Text: "AC/DC - The Jack", Value: "File", ImageUrl: "../../images/samples/tree/music.png", Folder: "" } ] }, { Text: "ロック", Value: "Folder", ImageUrl: "../../images/samples/tree/book.png", Folder: [{ Text: "ボン・ジョヴィ - It's My Life", Value: "File", ImageUrl: "../../images/samples/tree/music.png", Folder: "" }] }] }, { Text: "マイ ドキュメント", Value: "Folder", ImageUrl: "../../images/samples/tree/documents-folder.png", Folder: [ { Text: "2009", Value: "Folder", ImageUrl: "../../images/samples/tree/documents-folder.png", Folder: [ { Text: "月間レポート", Value: "File", ImageUrl: "../../images/samples/tree/documents.png", Folder: "" }, { Text: "年間レポート", Value: "File", ImageUrl: "../../images/samples/tree/documents.png", Folder: "" } ] }, { Text: "2010", Value: "Folder", ImageUrl: "../../images/samples/tree/documents-folder.png", Folder: [ { Text: "月間レポート", Value: "File", ImageUrl: "../../images/samples/tree/documents.png", Folder: "" }, { Text: "年間レポート", Value: "File", ImageUrl: "../../images/samples/tree/documents.png", Folder: "" } ] }] }, { Text: "ピクチャ", Value: "Folder", ImageUrl: "../../images/samples/tree/coins.png", Folder: [ { Text: "2009 年 バースデー", Value: "Folder", ImageUrl: "../../images/samples/tree/coins.png", Folder: [ { Text: "ピクチャ 1", Value: "File", ImageUrl: "../../images/samples/tree/coins_add.png", Folder: "" }, { Text: "ピクチャ 2", Value: "File", ImageUrl: "../../images/samples/tree/coins_add.png", Folder: "" }, { Text: "ピクチャ 3", Value: "File", ImageUrl: "../../images/samples/tree/coins_add.png", Folder: "" }, { Text: "ピクチャ 4", Value: "File", ImageUrl: "../../images/samples/tree/coins_add.png", Folder: "" } ] }, { Text: "2010 年 バースデー", Value: "Folder", ImageUrl: "../../images/samples/tree/coins.png", Folder: [ { Text: "ピクチャ 1", Value: "File", ImageUrl: "../../images/samples/tree/coins_add.png", Folder: "" }, { Text: "ピクチャ 2", Value: "File", ImageUrl: "../../images/samples/tree/coins_add.png", Folder: "" }, { Text: "ピクチャ 3", Value: "File", ImageUrl: "../../images/samples/tree/coins_add.png", Folder: "" } ] }] }, { Text: "ネットワーク", Value: "Folder", ImageUrl: "../../images/samples/tree/door.png", Folder: [ { Text: "アーカイブ", Value: "Folder", ImageUrl: "../../images/samples/tree/door_in.png", Folder: "" }, { Text: "バックアップ", Value: "Folder", ImageUrl: "../../images/samples/tree/door_in.png", Folder: "" }, { Text: "FTP", Value: "Folder", ImageUrl: "../../images/samples/tree/door_in.png", Folder: "" } ] }, { Text: "削除済み", Value: "Folder", ImageUrl: "../../images/samples/tree/bin_empty.png", Folder: "" } ] }];