Forum
01:01
11/04/2013
Code from myfirstgrid.html:
$("#list").jqGrid({
url: 'findToXml.php',
datatype: 'xml',
mtype: 'GET',
colNames: ['Inv No', 'Date', 'Amount', 'Tax', 'Total', 'Notes'],
colModel: [
{name:'invid', index:'invid', width:55, align:'right'},
{name:'invdate', index:'invdate', width:90, align:'center',
formatter:"date", formatoptions: {newformat:"d-m-Y"}, editable:true,
editrules:{date:true}},
{name:'amount', index:'amount', width:80, align:'right', formatter:'number', editable:true,
editrules:{required:true, number:true, maxValue:"9999.99", custom:true, custom_func:check1}},
{name:'tax', index:'tax', width:80, align:'right', formatter:'number', editable:true,
editrules:{required:true, number:true, maxValue:"9999.99", custom:true, custom_func:check1}},
{name:'total', index:'total', width:80, align:'right', formatter:'number'},
{name:'note', index:'note', width:150, sortable:false}
],
height: 300,
// height: 'auto',
rowNum: 30,
// rowList:[10,20,30],
sortname: 'invid',
sortorder: 'desc',
gridview: true,
caption: 'My first grid',
pager: '#pager',
// pgbuttons: false,
pginput: false,
viewrecords: false,
editurl: "editgrid.php"
}).navGrid('#pager', {}, //options
{reloadAfterSubmit:false, closeOnEscape:true, beforeSubmit:calcTotal, afterSubmit:response}, //prmEdit
{reloadAfterSubmit:false, closeOnEscape:true, beforeSubmit:calcTotal, afterSubmit:response,
afterComplete:function(response, postdata, formid){
$(this).jqGrid('setCell', postdata.invid, "note", "This is record "+postdata.invid);
}
}, //prmAdd
{reloadAfterSubmit:false, closeOnEscape:true, beforeSubmit:calcTotal, afterSubmit:response}, //prmDel
{sopt:['eq','ne','lt','le','gt','ge','bw','bn','ew','en','cn','nc']}, //prmSearch
{} //prmView
);
});
When I click "Add new record"
After Submit form "Add Record", date "19-10-2011″ is translated to "02-04-2025″ only in grid (data is transmitted to the server correctly: 19-10-2011).
I find a solution !
I replaced line 3001 in jquery.jqGrid.src V 4.4.5 (function addRowData)
v = t.formatter( rowid, $.jgrid.getAccessor(data,nm), i, data );
with
v = t.formatter( rowid, $.jgrid.getAccessor(data,nm), i, data, "edit" );
because $.fn.fmatter.date (called from formatter) work incorrectly (in this case) with act=="undefined".
That is the question ? Is it good or bad ?
09:43
Moderators
30/10/2007
Hello,
Humm – you are right, but I will not "fix" this, since it will break other code.
The problem here is that addRowData expect srcformat, which by default is "Y-m-d" and that is the reason for this "bug"
For the moment I think that one possible solution is that when adding a row from form edit and when reloadAfterSubmit is false not to change the date fields. Will see how to do this.
Thanks for this
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
46 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