3

階層データを表示するために、次の Infragistics コンポーネントを使用しています。http://www.igniteui.com/tree/drag-and-drop-single-tree

以下のようにツリービューを初期化して、ツリーのすべてのノードが最初に展開されているのを確認しました。最初に折りたたまれたすべてのノードを表示するオプションがない場合、誰かが私に提案してもらえますか?

 $("#tree").igTree({
                    checkboxMode: "off",
                    singleBranchExpand: true,
                    nodeClick: function (evt, ui) {

                        if (ui.node.data.Folder == "") {
                            var agreements = [];
                            var entry = [];

                            entry.push(ui.node.data.AgreementNbr);
                            entry.push(ui.node.data.ExternalDescription);
                            entry.push(ui.node.data.Description);
                            entry.push(ui.node.data.EffDate);
                            entry.push(ui.node.data.ExpDate);
                            entry.push(ui.node.data.ReleaseStatus);

                            agreements.push(entry);    

                            $('#example').DataTable({
                                responsive: true,
                                columns: [
                                { title: "Agreement Number" },
                                { title: "External Description" },
                                { title: "Description" },
                                { title: "Effective Date." },
                                { title: "Expiry Date" },
                                { title: "Release Status" }
                                ],
                                data: agreements,
                                destroy: true,
                                processing: true,
                            });
                        }
                        else {

                            var output = ui.node.data.Folder.map(function (obj) {

                                var a = [obj.AgreementNbr, obj.ExternalDescription, obj.Description, obj.EffDate, obj.ExpDate, obj.ReleaseStatus];
                                return Object.keys(a).map(function (key) {
                                    return a[key];

                                });
                            });

                            console.log(output);

                            $('#example').DataTable({
                                responsive: true,
                                columns: [
                                { title: "Agreement Number" },
                                { title: "External Description"},
                                { title: "Description"},
                                { title: "Effective Date"},
                                { title: "Expiry Date"},
                                { title: "Release Status"}
                                ],
                                data : output,
                                destroy: true
                            });
                        } 
                    },
                    dataSource: files,
                    dataSourceType: "json",
                    initialExpandDepth: 0,
                    pathSeparator: ".",
                    bindings: {
                        textKey: "Text",
                        valueKey: "Value",
                        imageUrlKey: "ImageUrl",
                        childDataProperty: "Folder",
                        Description: "Description"
                    },
                    // Enable Drag-and-drop feature
                    dragAndDrop: false
                });
4

1 に答える 1

5

initialExpandDepthオプションを使用する

initialExpandDepth : -1

そのオプションを に設定しています0
を に設定するinitialExpandDepth-1、最初はすべてのノードが折りたたまれて表示されます。

詳細については、 infragistics.comを参照してください。

于 2015-11-13T16:13:26.077 に答える