jQuery UI Widgets › Forums › Grid › grid grouping
Tagged: angular grid, date, grid, group, group by date only, groupable, grouping, jquery grid, jqxgrid, time, timestamp
This topic contains 1 reply, has 2 voices, and was last updated by Dimitar 9 years, 4 months ago.
Viewing 2 posts - 1 through 2 (of 2 total)
-
Authorgrid grouping Posts
-
Is there a way to group on part of a column.
I.e. column with date and time group on date only.Hello hm5161,
Unfortunately, this is not possible. However, if the time is not actually important for your grid, you can try the following approach using beforeLoadComplete:
<!DOCTYPE html> <html lang="en"> <head> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.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.columnsresize.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.grouping.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script> <script type="text/javascript" src="../../scripts/demos.js"></script> <script type="text/javascript"> $(document).ready(function () { var url = "../sampledata/beverages.txt"; var data = [{ Name: 'John', Date: '2015-07-20 10:27:09' }, { Name: 'Sam', Date: '2015-07-20 12:07:19'}]; var source = { datatype: "json", datafields: [ { name: 'Name', type: 'string' }, { name: 'Date', type: 'date' } ], localdata: data }; var dataAdapter = new $.jqx.dataAdapter(source, { beforeLoadComplete: function (records) { var newRecords = []; for (var i = 0; i < records.length; i++) { var date = records[i].Date, newDate = new Date(date.getFullYear(), date.getMonth(), date.getDate()); newRecords.push({ Name: records[i].Name, Date: newDate }); } return newRecords; } }); $("#jqxgrid").jqxGrid( { width: 850, source: dataAdapter, columnsresize: true, groupable: true, columns: [ { text: 'Name', datafield: 'Name', width: 250 }, { text: 'Date', datafield: 'Date', width: 250, cellsformat: 'd' } ] }); }); </script> </head> <body class='default'> <div id="jqxgrid"> </div> </body> </html>
Best Regards,
DimitarjQWidgets 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.