hello i am using JQ grid in my Asp.Net MVC application. there is a field named InvoiceDate in my grid and i have to group it with InvoiceDate, InvoiceDate is coming with Time and in grid I have to display date with time but for grouping i have to group it with only date i.e if i have 3 data
1. 08/29/2014 13:11:56
2. 08/29/2014 13:12:45
3. 08/30/2014 12:09:20
in grid i have to display date same as above but on grouping i have to group it with only date means
08/29/2014 and 08/30/2014 , Is it possible, if yes then please give me solution. My code is
jQuery("#ItemSoldReport").jqGrid({
data: ParsedJson,
datatype: "local",
height: 'auto',
width: 'auto',
rowNum: 100,
rowList: [10, 20, 30, 50, 100],
colNames: ['Date', 'UPC', 'Name', 'Department', 'Qty', 'Cost', 'Price', 'Margin'],
colModel: [
{ name: 'InvoiceDate', index: 'InvoiceDate', width: 90, sorttype: "date", summaryType: 'count', summaryTpl: '({0}) total', resizable: false, formatoptions: { newformat: 'm/d/Y' }, datefmt: "m/d/Y" },
{ name: 'Barcode', index: 'Barcode', width: 130, resizable: false, },
{ name: 'ItemName', index: 'ItemName', width: 150, resizable: false, },
{ name: 'DeptName', index: 'DeptName', width: 120, resizable: false },
{ name: 'ItemQuantity', index: 'ItemQuantity', width: 50, align: "right", sorttype: "int", resizable: false, },
{ name: 'CostPrice', index: 'CostPrice', width: 80, align: "right", sorttype: 'number', formatter: 'number', summaryType: 'sum', resizable: false, },
{ name: 'SalesPrice', index: 'SalesPrice', width: 80, align: "right", sorttype: "number", summaryType: 'sum', formatter: "number", resizable: false, },
{ name: 'ExtendedPriceMargin', index: 'ExtendedPriceMargin', width: 50, align: "right", resizable: false, },
],
pager: "#ItemSoldPager",
viewrecords: true,
sortorder: "desc",
caption: "Item Sold Report",
//sortname: 'DeptName',
grouping: true,
hidegrid: false,
groupingView: {
groupField: ['InvoiceDate'],
groupDataSorted: false,
groupText: ['<b>{0} - {1} Item(s)</b>'],
groupCollapse: true,
groupOrder: ['asc'],
groupSummary: [true],
//groupSorted: false,
},
footerrow: true,
userDataOnFooter: true,
onClickGroup: function (hid, collapsed) {
//saveCollapsedStateToLocalStorage(hid, collapsed)
var i;
i = $.inArray(hid, expandedGroups) > -1;
if (!collapsed && i == false) {
expandedGroups.push(hid);
}
else if (collapsed && i == true) {
//Grouphid.splice(i, 1);
expandedGroups.splice($.inArray(hid, expandedGroups), 1);
}
},
loadComplete: function () {
var $this = $(this),
//sum = $this.jqGrid("getCol", "SalesPrice", false, "sum"),
$footerRow = $(this.grid.sDiv).find("tr.footrow"),
localData = $this.jqGrid("getGridParam", "data"),
totalRows = localData.length,
totalSum = 0,
totalCostSum = 0,
$newFooterRow,
i;
for (i = 0; i < totalRows; i++) {
totalSum += parseFloat(localData[i].SalesPrice, 10);
totalCostSum += parseFloat(localData[i].CostPrice, 10);
}
$footerRow.find(">td[aria-describedby=" + this.id + "_InvoiceDate]")
.text("Grand Total:");
$footerRow.find(">td[aria-describedby=" + this.id + "_SalesPrice]")
.text($.fmatter.util.NumberFormat(totalSum, $.jgrid.formatter.number));
$footerRow.find(">td[aria-describedby=" + this.id + "_CostPrice]")
.text($.fmatter.util.NumberFormat(totalCostSum, $.jgrid.formatter.number));
if (expandedGroups.length > 0) {
for (var i = 0; i <= expandedGroups.length; i++) {
if (typeof (expandedGroups[i]) != "undefined") {
$this.jqGrid("groupingToggle", expandedGroups[i]);
}
}
}
}
});
jQuery("#ItemSoldReport").jqGrid('navGrid', '#ItemSoldPager', { add: false, edit: false, del: false });
jQuery("#ItemSoldReport").setGridWidth("100");