OSS で利用できる機能
ツリー - ドラッグ アンド ドロップ - 複数のツリー
このサンプルは CTP 機能を使用しています。製品版では、API や動作が変更される場合があります。
ファイル マネージャー 1
ファイル マネージャー 2
このサンプルは、より大きい画面サイズのためにデザインされました。
モバイル デバイスで画面を回転、フル サイズ表示、またはその他のデバイスにメールで送信します。
コード ビュー
クリップボードへコピー
<!DOCTYPE html> <html> <head> <title></title> <!-- 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" /> <style> .containerTree { overflow: auto; width: 100%; } .containerTree h3 { margin-bottom: 5px; } #left { display: inline; float: left; width: 350px; margin-right: 30px; margin-bottom: 10px; } #right { float: left; width: 350px; margin-bottom: 10px; } #firstTree, #secondTree { font-size: 14px; } @media screen and (max-width: 500px) { #left { width: 270px; } #right { width: 270px; clear: both; } } </style> <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> <!-- 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> </head> <body> <div class="containerTree"> <div id="left"> <h3>ファイル マネージャー 1</h3> <!--igTree target element--> <div id="firstTree"></div> </div> <div id="right"> <h3>ファイル マネージャー 2</h3> <!--igTree target element--> <div id="secondTree"></div> </div> </div> <script src="/data-files/hierarchical-files.js"></script> <script> $(function () { $("#firstTree").igTree({ checkboxMode: 'triState', singleBranchExpand: true, dataSource: $.extend(true, [], files), dataSourceType: 'json', initialExpandDepth: 0, pathSeparator: '.', bindings: { textKey: 'Text', valueKey: 'Value', imageUrlKey: 'ImageUrl', childDataProperty: 'Folder' }, dragAndDrop: true, dragAndDropSettings: { allowDrop: true, customDropValidation: function (element) { // Validates the drop target var valid = true, droppableNode = $(this); if (droppableNode.is('a') && droppableNode.closest('li[data-role=node]').attr('data-value') === 'File') { valid = false; } return valid; } } }); $("#secondTree").igTree({ checkboxMode: 'triState', singleBranchExpand: true, dataSource: $.extend(true, [], files), dataSourceType: 'json', initialExpandDepth: 0, pathSeparator: '.', bindings: { textKey: 'Text', valueKey: 'Value', imageUrlKey: 'ImageUrl', childDataProperty: 'Folder' }, dragAndDrop: true, dragAndDropSettings: { allowDrop: true, customDropValidation: function (element) { // Validates the drop target var valid = true, droppableNode = $(this); if (droppableNode.is('a') && droppableNode.closest('li[data-role=node]').attr('data-value') === 'File') { valid = false; } return valid; } } }); }); </script> </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: "" } ] }];