jQWidgets Forums
jQuery UI Widgets › Forums › DataTable › Using Group option with rowDetails
Tagged: datatable, group, rowdetails
This topic contains 1 reply, has 2 voices, and was last updated by Peter Stoev 10 years, 10 months ago.
Viewing 2 posts - 1 through 2 (of 2 total)
-
Author
-
Hello,
I am using DataTable.
I have added option ‘groups’and ‘groupsRenderer’ optionsand its working GOOD.
Now I want to Add ‘rowDetails: true and initRowDetails: initRowDetails’ in datatable.Is this possible????
Please suggest
Hi Manojsingh,
Yes, it is possible to have rowDetails and Groups:
Example:
<!DOCTYPE html> <html lang="en"> <head> <title id="Description">Data Grouping in jqxDataTable</title> <meta name="description" content="This sample demonstrates how we can Group Data by using jQWidgets DataTable."> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="../../scripts/jquery-1.10.2.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.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/jqxdatatable.js"></script> <script type="text/javascript" src="../../scripts/demos.js"></script> <script type="text/javascript"> $(document).ready(function () { // prepare the data var source = { dataType: "xml", dataFields: [ { name: 'SupplierName', type: 'string' }, { name: 'Quantity', type: 'number' }, { name: 'OrderDate', type: 'date' }, { name: 'OrderAddress', type: 'string' }, { name: 'Freight', type: 'number' }, { name: 'Price', type: 'number' }, { name: 'City', type: 'string' }, { name: 'ProductName', type: 'string' }, { name: 'Address', type: 'string' } ], url: '../sampledata/orderdetailsextended.xml', root: 'DATA', record: 'ROW' }; var dataAdapter = new $.jqx.dataAdapter(source, { loadComplete: function () { // data is loaded. } }); var initRowDetails = function (id, row, element, rowinfo) { } // create jqxDataTable. $("#dataTable").jqxDataTable( { source: dataAdapter, pageable: true, altRows: true, initRowDetails: initRowDetails, rowDetails: true, sortable: true, groups: ['SupplierName'], width: 850, groupsRenderer: function(value, rowData, level) { return "Supplier Name: " + value; }, columns: [ { text: 'Supplier Name', hidden: true, cellsAlign: 'left', align: 'left', dataField: 'SupplierName', width: 280}, { text: 'Product Name', cellsAlign: 'left', align: 'left', dataField: 'ProductName', width: 250 }, { text: 'Quantity', dataField: 'Quantity', cellsformat: 'd', cellsAlign: 'right', align: 'right', width: 80 }, { text: 'Price', dataField: 'Price', cellsformat: 'c2', align: 'right', cellsAlign: 'right', width: 70 }, { text: 'Address', cellsAlign: 'center', align: 'center', dataField: 'Address', width: 250 }, { text: 'City', cellsAlign: 'center', align: 'center', dataField: 'City' } ] }); }); </script> </head> <body class='default'> <div id="dataTable"></div> </body> </html>
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.