Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
addRowData work incorrectly in grid
12/04/2013
01:01
Avatar
Raducu
Braila, Romania
New Member
Members
Forum Posts: 1
Member Since:
11/04/2013
sp_UserOfflineSmall Offline

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"

beforeImage Enlarger

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).

afterImage Enlarger

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 ?

15/04/2013
09:43
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
35 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information