你如何在jQGrid中按时间排序日期?我看了一下说明我应该使用"AmPm"功能的文档.但是,考虑到AM/PM时,我仍然无法对其进行排序,特别是在"登录日期"字段中.
<!DOCTYPE HTML>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>My First Grid</title>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/themes/redmond/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-3.8/css/ui.jqgrid.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-3.8/js/i18n/grid.locale-en.js"></script>
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-3.8/js/jquery.jqGrid.min.js"></script>
<script type="text/javascript">
$.jgrid.no_legacy_api = true;
$.jgrid.useJSON = true;
</script>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#list1").jqGrid({
url: 'login-history.xml',
datatype: "xml",
mtype: "GET",
colNames:["Role","Member Name","Login Date","Logout Date","Duration"],
colModel:[
{name:"Role",width:220, xmlmap:"Role"},
{name:"Member Name",width:120, xmlmap:"MemberFullName"},
{name:"Login Date", width:150,xmlmap:"LoginDateTime", sorttype: "date", datefmt: "m/d/Y h:i AmPm" },
{name:"Logout Date", width:140,xmlmap:"LogoffDateTime", formatter:'date', formatoptions:{ srcformat:'m/d/Y …Run Code Online (Sandbox Code Playgroud)