Available in the Full Version
Hierarchical Grid - TypeScript
This sample shows how to create basic igHierarchialGrid using TypeScript and specific language custom classes for data that is being used.
This sample uses CTP (Community Technical Preview) features. The API and behavior may change when these features are released with full support.
This sample is designed for a larger screen size.
On mobile, try rotating your screen, view full size, or email to another device.
Code View
Copy to Clipboard
<!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" /> <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> <table id="hierarchial-grid"></table> <script src="/TypeScriptSamples/hierarchical-grid/typescript.js"></script> </body> </html>
/// <reference path="/js/typings/jquery.d.ts" /> /// <reference path="/js/typings/jqueryui.d.ts" /> /// <reference path="/js/typings/igniteui.d.ts" /> //Sample data construction //----------------------------------------- class Product { name: string; quantity: number; constructor(productName: string, inQuantity: number) { this.name = productName; this.quantity = inQuantity; } } class ProductContainer { type: string; products: Product[]; constructor(productType: string, inProducts : Product[]) { this.type = productType; this.products = inProducts; } } var foods: Product[] = []; foods.push(new Product("Bread", 3)); foods.push(new Product("Pizza", 4)); var beverages: Product[] = []; beverages.push(new Product("Milk", 1)); beverages.push(new Product("Fruit punch", 4)); var sampleData: ProductContainer[] = []; sampleData.push(new ProductContainer("Food", foods)); sampleData.push(new ProductContainer("Beverages", beverages)); //----------------------------------------- $(function () { $("#hierarchial-grid").igHierarchicalGrid({ width: "100%", dataSource: sampleData, features: [ { name: "Responsive", enableVerticalRendering: false, columnSettings: [ { columnKey: "type", classes: "ui-hidden-tablet" }, ] }, { name: "RowSelectors", enableCheckBoxes: true, inherit: true }, { name: "Selection", multipleSelection: true } ], autoGenerateColumns: false, primaryKey: "type", columns: [ { key: "type", headerText: "Type", dataType: "string" } ], autoGenerateLayouts: false, columnLayouts: [ { width: "100%", childrenDataProperty: "products", autoGenerateColumns: false, primaryKey: "name", columns: [ { key: "name", headerText: "Name", dataType: "string", width: "70%", }, { key: "quantity", headerText: "Quantity", dataType: "number", width: "30%" } ], features: [ { name: "Responsive", enableVerticalRendering: false, columnSettings: [ { columnKey: "name", classes: "ui-hidden-tablet" }, { columnKey: "quantity", classes: "ui-hidden-tablet" } ] } ] } ], }); })