Sorry, but I can't reproduce displaying '2012-08-20T18:27:25.05'
as '08/21/2012 03:25 AM'
by no formatoptions
which you included. To display hour with leading zeros you should use formatter: "date"
with h:i
instead of H:i
(see here PHP date format used in jqGrid)
formatoptions: { srcformat: "ISO8601Long", newformat: "m/d/Y h:i A" }
The demo display correct formatted date:
UPDATED: I debugged the demo which you posted. The reason of the described problem is wrong grid.locale-en.min.js
which you used. Replacing it to the original grid.locale-en.js
fixs the problem.
jqGrid don't provides full minimized versions of jqGrid files. I personally use Microsoft Ajax Minifier to generate minimized version of grid.locale-en.js
and ui.jqgrid.css
. Frequently I use modified version of jquery.jqGrid.src.js
which includes some bug fixes. So I generate new jquery.jqGrid.min.js
from the modified version of jquery.jqGrid.src.js
too. One more important feature which I miss in the standard redistributes of jqGrid are map files which allows to see in debugger the original jquery.jqGrid.src.js
during using minimizes version (jquery.jqGrid.min.js
). Microsoft Ajax Minifier allows to generates Source Map file by usage of –map:v3
switch.
So I minimize the original jquery.jqGrid.src.js
, grid.locale-en.js
and ui.jqgrid.css
files (all the files are in the current directory in the below example) with the following calls of Microsoft Ajax Minifier:
SET AjaxMinExe=%ProgramFiles(x86)%\Microsoft\Microsoft Ajax Minifier\AjaxMin.exe
"%AjaxMinExe%" -enc:in utf-8 -clobber:true jquery.jqGrid.src.js -o jquery.jqGrid.min.js -map:v3 jquery.jqGrid.min.map
"%AjaxMinExe%" -enc:in utf-8 -enc:out utf-8 -clobber:true grid.locale-en.js -o grid.locale-en.min.js -map:v3 grid.locale-en.min.map
"%AjaxMinExe%" -clobber:true ui.jqgrid.css -o ui.jqgrid.min.css -map:v3 ui.jqgrid.min.map
I tested your demo using original and minimized jqGrid files and both produces the same correct date format.
Some other common remarks to the code of your demo:
- I strictly recommend to use
gridview: true
option in all your grids (see the answer) which will improve performance of your grid without any disadvantages.
- I recommend to include original
ui.jqgrid.css
in your project. Currently you set many CSS rules in your custom production.min.css
. It makes complex debugging of your project and make difficult moving to the next version of jqGrid in the future.
- You use
!important
attribute in many rules which you specify. I don't recommend you to do this. One have to use !important
only if one need to overwrite other CSS setting which already uses !important
. In other cases it's enough to specify more specific CSS rule. For example instead of .ui-jqgrid .ui-jqgrid-bdiv { height: 300px !important; }
you can just use height: 300
option of jqGrid or specify .ui-jqgrid .ui-jqgrid-bdiv { height: 300px; }
.
- I understand that one have to add some CSS rules if one use
bootstrap.css
. I posted some my suggestion about the subject. You can try to add the following roles after <link>
which includes bootstrap.min.css
and ui.jqgrid.css
:
<style type="text/css">
.ui-jqgrid .ui-pg-table .ui-pg-input, .ui-jqgrid .ui-pg-table .ui-pg-selbox {
height: auto;
width: auto;
line-height: inherit;
}
.ui-jqgrid .ui-pg-table .ui-pg-selbox {
padding: 1px;
}
.ui-jqgrid { line-height: normal; }
.ui-jqgrid table {
border-collapse: separate;
border-style: none;
border-top-style: none;
}
.ui-jqgrid table.ui-jqgrid-btable {
}
.ui-paging-info { display: inline; }
.ui-jqgrid .ui-pg-table { border-collapse: separate; }
div.ui-jqgrid-view table.ui-jqgrid-btable td {
border-left-style: none
}
div.ui-jqgrid-view table.ui-jqgrid-htable {
border-style: none;
border-top-style: none;
border-collapse: separate;
}
div.ui-jqgrid-view table.ui-jqgrid-btable th {
border-left-style: none
}
.ui-jqgrid .ui-jqgrid-htable th div {
height: auto;
}
.ui-jqgrid .ui-jqgrid-resize {
height: 18px !important;
}
.ui-jqgrid .ui-pg-table {
padding-bottom: 0;
}
.ui-jqgrid>.ui-jqgrid-pager {
border-right-color: inherit !important;
border-right-style: solid !important;
border-right-width: 1px !important;
}
.ui-jqgrid tr.jqgrow td {
vertical-align: middle;
}
.ui-jqgrid tr.jqgrow {
height: auto;
}
.ui-jqgrid .ui-jqgrid-pager {
height: auto;
}
</style>
I get the rules from my old demo which uses bootstrap.css
too. In your case you will need probably add additionally
.ui-jqgrid .ui-jqgrid-bdiv {
height: auto !important;
}
.ui-jqgrid tr.jqgrow td button.btn {
margin: 2px 0;
}
I think that the above CSS will improve the look of your page.