Forum
13:31
24/02/2014
Hi,
We have a Date with time in grid with filter toolbar and when we try to filter by date it not working properly.Below is the code for replicate the same.
Jqgrid version : 4.4.4
<script language="javascript" type="text/javascript">
$(document).ready(function () {
var mydata = [
{ id: "1", invdate: "2007-10-01 9:30:00 AM", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00" },
{ id: "2", invdate: "2007-10-02 9:30:00 AM", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00" },
{ id: "3", invdate: "2007-09-01 9:30:00 AM", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00" },
{ id: "4", invdate: "2007-10-04 9:30:00 AM", name: "test4", note: "note4", amount: "200.00", tax: "10.00", total: "210.00" },
{ id: "5", invdate: "2007-10-05 9:30:00 AM", name: "test5", note: "note5", amount: "300.00", tax: "20.00", total: "320.00" },
{ id: "6", invdate: "2007-09-06 9:30:00 AM", name: "test6", note: "note6", amount: "400.00", tax: "30.00", total: "430.00" },
{ id: "7", invdate: "2007-10-04 9:30:00 AM", name: "Test7", note: "note7", amount: "200.00", tax: "10.00", total: "210.00" },
{ id: "8", invdate: "2007-10-03 9:30:00 AM", name: "test8", note: "note8", amount: "300.00", tax: "20.00", total: "320.00" },
{ id: "9", invdate: "2007-09-01 9:30:00 AM", name: "test9", note: "note9", amount: "400.00", tax: "30.00", total: "430.00" },
{ id: "10", invdate: "2007-09-08 9:30:00 AM", name: "test10", note: "note10", amount: "500.00", tax: "30.00", total: "530.00" },
{ id: "11", invdate: "2007-09-08 9:30:00 AM", name: "Test11", note: "note11", amount: "500.00", tax: "30.00", total: "530.00" },
{ id: "12", invdate: "2007-09-10 9:30:00 AM", name: "test12", note: "note12", amount: "500.00", tax: "30.00", total: "530.00" }
];
var myGrid = $("#list");
myGrid.jqGrid({
datatype: "local",
data: mydata,
colNames: ['Inv No', 'Date', 'Client', 'Amount', 'Tax', 'Total', 'Notes'],
colModel: [
{ name: 'id', index: 'id', width: 65, sorttype: 'int' },
{ name: 'invdate', index: 'invdate', width: 120, align: 'center', sorttype: 'date',
formatter: 'date', formatoptions: { newformat: 'm/d/Y' },
searchoptions: { sopt: ['eq'],
dataInit: function (elem) {
$(elem).datepicker({ changeYear: true, changeMonth: true, showButtonPanel: true });
}
}
},
{ name: 'name', index: 'name', width: 90 },
{ name: 'amount', index: 'amount', width: 70, formatter: 'number', align: "right" },
{ name: 'tax', index: 'tax', width: 60, formatter: 'number', align: "right" },
{ name: 'total', index: 'total', width: 60, formatter: 'number', align: "right" },
{ name: 'note', index: 'note', width: 100, sortable: false }
],
rowNum: 10,
rowList: [5, 10, 20],
pager: '#pager',
ignoreCase: true,
sortname: 'invdate',
viewrecords: true,
sortorder: "desc",
caption: "Sorting and paging of local data",
height: "100%"
}).jqGrid('navGrid', '#pager', { add: false, edit: false, del: false });
myGrid.jqGrid('filterToolbar',
{ stringResult: true, searchOnEnter: false, defaultSearch: "cn" });
});
</script>
Most Users Ever Online: 715
Currently Online:
38 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66