@{
    ViewBag.Title = "jQWidgets TreeGrid";
}
@section scripts {
    <script type="text/javascript">
        $(document).ready(function () {
            // prepare the data
            var source =
            {
                dataType: "json",
                dataFields: [
                    { name: 'EmployeeID', type: 'number' },
                    { name: 'ManagerID', type: 'number' },
                    { name: 'FirstName', type: 'string' },
                    { name: 'LastName', type: 'string' },
                    { name: 'Country', type: 'string' },
                    { name: 'City', type: 'string' },
                    { name: 'Address', type: 'string' },
                    { name: 'Title', type: 'string' },
                    { name: 'HireDate', type: 'date' },
                    { name: 'BirthDate', type: 'date' }
                ],
                hierarchy:
                {
                    keyDataField: { name: 'EmployeeID' },
                    parentDataField: { name: 'ManagerID' }
                },
                id: 'EmployeeID',
                url: '/Employee/GetEmployees'
            };
            var dataAdapter = new $.jqx.dataAdapter(source);
            // create Tree Grid
            $("#treeGrid").jqxTreeGrid(
            {
                width: 850,
                source: dataAdapter,
                sortable: true,
                ready: function () {
                    $("#treeGrid").jqxTreeGrid('expandRow', '2');
                },
                columns: [
                  { text: 'FirstName', dataField: 'FirstName', width: 200 },
                  { text: 'LastName', dataField: 'LastName', width: 200 },
                  { text: 'Title', dataField: 'Title', width: 160 },
                  { text: 'Birth Date', dataField: 'BirthDate', cellsFormat: 'd', width: 120 },
                  { text: 'Hire Date', dataField: 'HireDate', cellsFormat: 'd', width: 120 },
                  { text: 'Address', dataField: 'Address', width: 250 },
                  { text: 'City', dataField: 'City', width: 120 },
                  { text: 'Country', dataField: 'Country' }
                ]
            });
        });
    </script>
}
<div id="treeGrid"></div>
