コード例 #1
0
        static void OnReady()
        {
            var serviceRoot = "http://demos.kendoui.com/service";
            var homogeneous = new HierarchicalDataSource(new HierarchicalDataSourceConfiguration
            {
                transport = new DataSourceTransportConfiguration
                {
                    read = new DataSourceTransportReadConfiguration
                    {
                        url      = serviceRoot + "/Employees",
                        dataType = "jsonp"
                    }
                },
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        id = "EmployeeId",
                        hasChildrenString = "HasEmployees"
                    }
                }
            });

            new jQuery("#treeview").kendoTreeView(new TreeViewConfiguration
            {
                dataSource    = homogeneous.As <JsArray>(),
                dataTextField = "FullName"
            });
        }
コード例 #2
0
ファイル: RemoteData.cs プロジェクト: fjgandrade/sharpkit
        static void OnReady()
        {
            var serviceRoot = "http://demos.kendoui.com/service";
            var homogeneous = new HierarchicalDataSource(new HierarchicalDataSourceConfiguration
            {
                transport = new DataSourceTransportConfiguration
                {
                    read = new DataSourceTransportReadConfiguration
                    {
                        url = serviceRoot + "/Employees",
                        dataType = "jsonp"
                    }
                },
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        id = "EmployeeId",
                        hasChildrenString = "HasEmployees"
                    }
                }
            });

            new jQuery("#treeview").kendoTreeView(new TreeViewConfiguration
            {
                dataSource = homogeneous.As<JsArray>(),
                dataTextField = "FullName"
            });

        }
コード例 #3
0
        static void OnReady()
        {
            var inlineDefault = new HierarchicalDataSource(new HierarchicalDataSourceConfiguration
            {
                data = new JsArray {
                    new { text = "Furniture", items = new JsArray {
                              new { text = "Tables & Chairs" },
                              new { text = "Sofas" },
                              new { text = "Occasional Furniture" }
                          } },
                    new { text = "Decor", items = new JsArray {
                              new { text = "Bed Linen" },
                              new { text = "Curtains & Blinds" },
                              new { text = "Carpets" }
                          } }
                }
            });

            var inline = new HierarchicalDataSource(new HierarchicalDataSourceConfiguration
            {
                data = new JsArray {
                    new { categoryName = "Storage", subCategories = new JsArray {
                              new { subCategoryName = "Wall Shelving" },
                              new { subCategoryName = "Floor Shelving" },
                              new{ subCategoryName = "Kids Storage" }
                          } },
                    new { categoryName = "Lights", subCategories = new JsArray {
                              new { subCategoryName = "Ceiling" },
                              new { subCategoryName = "Table" },
                              new { subCategoryName = "Floor" }
                          } }
                },
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        children = "subCategories"
                    }
                }
            });

            new jQuery("#treeview-left").kendoTreeView(new TreeViewConfiguration
            {
                dataSource = inlineDefault.As <JsArray>()
            });
            new jQuery("#treeview-right").kendoTreeView(new TreeViewConfiguration
            {
                dataSource    = inline.As <JsArray>(),
                dataTextField = new JsArray <JsString> {
                    "categoryName", "subCategoryName"
                }.As <JsString>()
            });
        }
コード例 #4
0
ファイル: LocalData.cs プロジェクト: fjgandrade/sharpkit
        static void OnReady()
        {
            var inlineDefault = new HierarchicalDataSource(new HierarchicalDataSourceConfiguration
            {
                data = new JsArray {
                        new { text = "Furniture", items = new JsArray {
                            new { text = "Tables & Chairs" },
                            new { text = "Sofas" },
                            new { text = "Occasional Furniture" }
                        } },
                        new { text = "Decor", items = new JsArray {
                            new { text = "Bed Linen" },
                            new { text = "Curtains & Blinds" },
                            new { text = "Carpets" }
                        } }
                    }
            });

            var inline = new HierarchicalDataSource(new HierarchicalDataSourceConfiguration
            {
                data = new JsArray {
                        new { categoryName = "Storage", subCategories = new JsArray {
                            new { subCategoryName = "Wall Shelving" },
                            new { subCategoryName = "Floor Shelving" },
                            new{ subCategoryName = "Kids Storage" }
                        } },
                        new { categoryName = "Lights", subCategories = new JsArray {
                            new { subCategoryName = "Ceiling" },
                            new { subCategoryName = "Table" },
                            new { subCategoryName = "Floor" }
                        } }
                    },
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        children = "subCategories"
                    }
                }
            });
            new jQuery("#treeview-left").kendoTreeView(new TreeViewConfiguration
            {
                dataSource = inlineDefault.As<JsArray>()
            });
            new jQuery("#treeview-right").kendoTreeView(new TreeViewConfiguration
            {
                dataSource = inline.As<JsArray>(),
                dataTextField = new JsArray<JsString> { "categoryName", "subCategoryName" }.As<JsString>()
            });
        }
コード例 #5
0
ファイル: OdataBinding.cs プロジェクト: fjgandrade/sharpkit
        static void OnReady()
        {
            // TreeView bound to Categories > Products > OrderDetails
            var OrderDetails = new DataSourceConfiguration
            {
                type = "odata",
                transport = new DataSourceTransportConfiguration
                {
                    read = new DataSourceTransportReadConfiguration
                    {
                        urlFunc = options => Kendo.format("http://demos.kendoui.com/service/Northwind.svc/Products({0})/Order_Details", options.As<JsObject>()["ProductID"].As<JsNumber>())
                    }
                },
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        hasChildrenFunc = () => false

                    }
                }
            };

            var Products = new HierarchicalDataSourceConfiguration
            {
                type = "odata",
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        id = "ProductID",
                        hasChildrenString = "Order_Details",
                        children = OrderDetails
                    }
                },
                transport = new DataSourceTransportConfiguration
                {
                    read = new DataSourceTransportReadConfiguration
                    {
                        urlFunc = options => Kendo.format("http://demos.kendoui.com/service/Northwind.svc/Categories({0})/Products", options.As<JsObject>()["CategoryID"].As<JsNumber>())
                    }
                }
            };

            var Categories = new HierarchicalDataSource(new HierarchicalDataSourceConfiguration
            {
                type = "odata",
                transport = new DataSourceTransportConfiguration
                {
                    read = new DataSourceTransportReadConfiguration
                    {
                        url = "http://demos.kendoui.com/service/Northwind.svc/Categories"
                    }
                },
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        hasChildrenString = "Products",
                        id = "CategoryID",
                        children = Products
                    }
                }
            });

            new jQuery("#treeview").kendoTreeView(new TreeViewConfiguration
            {
                dataSource = Categories.As<JsArray>(),
                dataTextField = new JsArray<JsString> { "CategoryName", "ProductName", "OrderID" }.As<JsString>()
            });
        }
コード例 #6
0
        static void OnReady()
        {
            // TreeView bound to Categories > Products > OrderDetails
            var OrderDetails = new DataSourceConfiguration
            {
                type      = "odata",
                transport = new DataSourceTransportConfiguration
                {
                    read = new DataSourceTransportReadConfiguration
                    {
                        urlFunc = options => Kendo.format("http://demos.kendoui.com/service/Northwind.svc/Products({0})/Order_Details", options.As <JsObject>()["ProductID"].As <JsNumber>())
                    }
                },
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        hasChildrenFunc = () => false
                    }
                }
            };

            var Products = new HierarchicalDataSourceConfiguration
            {
                type   = "odata",
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        id = "ProductID",
                        hasChildrenString = "Order_Details",
                        children          = OrderDetails
                    }
                },
                transport = new DataSourceTransportConfiguration
                {
                    read = new DataSourceTransportReadConfiguration
                    {
                        urlFunc = options => Kendo.format("http://demos.kendoui.com/service/Northwind.svc/Categories({0})/Products", options.As <JsObject>()["CategoryID"].As <JsNumber>())
                    }
                }
            };

            var Categories = new HierarchicalDataSource(new HierarchicalDataSourceConfiguration
            {
                type      = "odata",
                transport = new DataSourceTransportConfiguration
                {
                    read = new DataSourceTransportReadConfiguration
                    {
                        url = "http://demos.kendoui.com/service/Northwind.svc/Categories"
                    }
                },
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        hasChildrenString = "Products",
                        id       = "CategoryID",
                        children = Products
                    }
                }
            });

            new jQuery("#treeview").kendoTreeView(new TreeViewConfiguration
            {
                dataSource    = Categories.As <JsArray>(),
                dataTextField = new JsArray <JsString> {
                    "CategoryName", "ProductName", "OrderID"
                }.As <JsString>()
            });
        }