jq(function(){
var token = window.location.href
.substring(window.location.href
.lastIndexOf('=') + 1);
jq("#grid").jqGrid({
url:'/test/umpire/getFixtures',
datatype: 'json',
mtype: 'GET',
colNames:['Category', 'Tournament','Date', 'Ground','Team 1','Team 2','Umpire 1','Umpire2','Umpire 3','Match Refree','Match Obsrver','Scorer 1','Scorer 2'],
colModel:[
{name:'categoryName',index:'categoryName', width:100,editable:true, editrules:{required:true}, editoptions:{size:10,readonly: 'readonly'}},
{name:'tournamentName',index:'tournamentName', width:200,editable:true, editrules:{required:true}, editoptions:{size:10}},
{name:'matchFromDate',index:'matchFromDate', width:100,formatter: "date",sorttype: "date",formatoptions:{srcformat: "U/1000", newformat: "m/d/Y"},search:true, searchoptions: {sopt: ['eq','ne'],
dataInit : function (elem) {
jq(elem).datepicker({dateFormat:'mm-dd-yy', changeYear: true, changeMonth: true, showButtonPanel: true, showOn: 'focus'});
}}},
{name:'groundName',index:'groundName', width:100,editable:true, editrules:{required:true}, editoptions:{size:10}},
{name:'team1Name',index:'team1Name', width:150,editable:true, editrules:{required:true}, editoptions:{size:10}},
{name:'team2Name',index:'team2Name', width:150,editable:true, editrules:{required:true}, editoptions:{size:10}},
{name:'umpire1',index:'umpire1', width:100,formatter: function (cellvalue, options, rowObject) {
return '<a href="/TNCA/umpire/assign?id=' + options.rowId + '&name='+cellvalue+'&token=${token}">'+cellvalue+'</a>';
}},
{name:'umpire2',index:'umpire2', width:100,formatter: function (cellvalue, options, rowObject) {
return '<a href="/TNCA/umpire/assign?id=' + options.rowId + '&name='+cellvalue+'&token=${token}">'+cellvalue+'</a>';
}},
{name:'umpire3',index:'umpire3', width:100,formatter: function (cellvalue, options, rowObject) {
return '<a href="/TNCA/umpire/assign?id=' + options.rowId + '&name='+cellvalue+'&token=${token}">'+cellvalue+'</a>';
}},
{name:'matchRefree',index:'matchRefree', width:100,formatter: function (cellvalue, options, rowObject) {
return '<a href="/TNCA/umpire/assign?id=' + options.rowId + '&name='+cellvalue+'&token=${token}">'+cellvalue+'</a>';
}},
{name:'matchObserver',index:'matchObserver', width:100,formatter: function (cellvalue, options, rowObject) {
return '<a href="/TNCA/umpire/assign?id=' + options.rowId + '&name='+cellvalue+'&token=${token}">'+cellvalue+'</a>';
}},
{name:'scorer1',index:'scorer1', width:100,formatter: function (cellvalue, options, rowObject) {
return '<a href="/TNCA/umpire/assign?id=' + options.rowId + '&name='+cellvalue+'&token=${token}">'+cellvalue+'</a>';
}},
{name:'scorer2',index:'scorer2', width:100, formatter: function (cellvalue, options, rowObject) {
return '<a href="/TNCA/umpire/assign?id=' + options.rowId + '&name='+cellvalue+'&token=${token}">'+cellvalue+'</a>';
}},
],
postData:{
filters:'{"groupOp":"AND","rules":[{"field":"matchFromDate","op":"gt","data":"2007-09-06"},{"field":"matchFromDate","op":"lt","data":"2007-10-04"}]}'
},
editurl :"/test/home/?token=${token}",
rowNum:20,
shrinkToFit: true,
rowList:[10,20,30],
height: 400,
autowidth: true,
rownumbers: true,
pager: '#pager',
sortname: 'matchFromDate',
viewrecords: true,
height:"100%",
sortorder: "asc",
caption:"<h2>Assign Umpire</h2>",
emptyrecords: "Empty records",
loadonce: true,
loadComplete: function(response) {
console.log(JSON.stringify(response))
},
jsonReader : {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: false,
cell: "cell",
id: "tournamentID"
}
});
Ciao sopra è il mio codice jqgrid. Ho problemi nella ricerca del campo data (matchFromDate). Ho trovato molte risposte fornite in questo forum, ma ancora non ho potuto ottenere la ricerca della data.Jqgrid cerca le date non funziona
Da JSON che sto ricevendo la data così la versione '1.432.683,305 milioni'
mio jqGrid è 4.8.2 e sto usando Spring MVC.
Qualcuno può aiutarmi a risolvere questo problema? Grazie mille in anticipo
che ti dà la data di quanti millisecondi da una data (1/1/1970) quindi se la passi in una nuova data (1432683305000), puoi ottenere la data corrente. – Daemedeor
Sì, posso farlo mettendo u/1000 in formato opzione. Il mio problema è che la ricerca non funziona con la data. – Rajkumar
Con "problemi di ricerca nel campo della data" potresti espandere? Non vedo nessuna opzione che stai passando in ricerca? – Daemedeor