UNPKG

jqwidgets-framework

Version:

jQWidgets is an advanced jQuery, Angular, React, ASP .NET MVC, Custom Elements and HTML5 UI framework.

101 lines (93 loc) 4.84 kB
<!DOCTYPE html> <html lang="en"> <head> <title id='Description'>Grid Custom Element ForeignKeyColumn</title> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1 minimum-scale=1" /> <meta name="description" content="This is an example of Custom Element Grid's foreign key column." /> <link rel="stylesheet" href="../jqwidgets/styles/jqx.base.css" type="text/css" /> <link rel="stylesheet" href="../styles/demos.css" type="text/css" /> <script type="text/javascript" src="../scripts/webcomponents-lite.min.js"></script> <script type="text/javascript" src="../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../jqwidgets/jqxcore.elements.js"></script> <script type="text/javascript" src="../jqwidgets/jqxdata.js"></script> <script type="text/javascript" src="../jqwidgets/jqxbuttons.js"></script> <script type="text/javascript" src="../jqwidgets/jqxscrollbar.js"></script> <script type="text/javascript" src="../jqwidgets/jqxmenu.js"></script> <script type="text/javascript" src="../jqwidgets/jqxgrid.js"></script> <script type="text/javascript" src="../jqwidgets/jqxgrid.selection.js"></script> <script type="text/javascript" src="../jqwidgets/jqxgrid.pager.js"></script> <script type="text/javascript" src="../jqwidgets/jqxlistbox.js"></script> <script type="text/javascript" src="../jqwidgets/jqxgrid.edit.js"></script> <script type="text/javascript" src="../jqwidgets/jqxdropdownlist.js"></script> <script type="text/javascript" src="../jqwidgets/jqxcombobox.js"></script> <script type="text/javascript" src="../jqwidgets/jqxpanel.js"></script> <script type="text/javascript" src="../scripts/demos.js"></script> <script type="text/javascript"> var employeesSource = { datatype: 'xml', datafields: [ { name: 'FirstName', type: 'string' }, { name: 'LastName', type: 'string' } ], root: 'Employees', record: 'Employee', id: 'EmployeeID', async: false, url: '../sampledata/employees.xml' }; var employeesAdapter = new jqx.dataAdapter(employeesSource, { autoBind: true, beforeLoadComplete: (records) => { var data = new Array(); for (var i = 0; i < records.length; i++) { var employee = records[i]; employee.EmployeeName = employee.FirstName + ' ' + employee.LastName; employee.EmployeeID = employee.uid; data.push(employee); } return data; } }); var ordersSource = { datatype: 'xml', async: false, datafields: [ { name: 'EmployeeID', map: 'm\\:properties>d\\:EmployeeID', values: { source: employeesAdapter.records, name: 'EmployeeName' } }, { name: 'ShippedDate', map: 'm\\:properties>d\\:ShippedDate', type: 'date' }, { name: 'Freight', map: 'm\\:properties>d\\:Freight', type: 'float' }, { name: 'ShipName', map: 'm\\:properties>d\\:ShipName' }, { name: 'ShipAddress', map: 'm\\:properties>d\\:ShipAddress' }, { name: 'ShipCity', map: 'm\\:properties>d\\:ShipCity' }, { name: 'ShipCountry', map: 'm\\:properties>d\\:ShipCountry' } ], root: 'entry', record: 'content', id: 'm\\:properties>d\\:OrderID', url: '../sampledata/orders.xml' }; var ordersAdapter = new jqx.dataAdapter(ordersSource); JQXElements.settings['gridSettings'] = { source: ordersAdapter, selectionmode: 'multiplecellsextended', pageable: true, autoheight: true, columns: [ { text: 'Employee Name', datafield: 'EmployeeID', width: 150 }, { text: 'Ship City', datafield: 'ShipCity', width: 150 }, { text: 'Ship Country', datafield: 'ShipCountry', width: 150 }, { text: 'Ship Name', datafield: 'ShipName' } ] }; </script> </head> <body> <div class="example-description"> This example shows how to create a Custom element Grid with a Foreign Key column </div> <jqx-grid settings="gridSettings"></jqx-grid> </body> </html>