Forum

July 10th, 2011
You must be logged in to post Login Register

Search Forums:


 






addRowData results in "TypeError: value is undefined" for columns with formatters defined?

No Tags
UserPost

22:28
04/06/2012


hughitt1

Member

posts 17

I'm just trying out the "addRowData" method in jqGrid 4.3.2 for the first time to see if I can asynchronously load row data from multiple sources.


To start with, I load a table with some data the "normal" way (not using addRowData()) to verify that everything is working, and everything works.


When I then try to add a new row (e.g. using one of the rows from the initial working result):


var new_row = [{"time":{"end":"20120507235959","start":"20120507000000"}];

$("#grid").jqGrid('addRowData', 0, new_row)

 

Where time.start and time.end are defined in colModel as:


            {name: 'timestart', index: 'time.start', jsonmap: 'time.start', formatter: self._formatters.date, width: 145, fixed: true},
            {name: 'timeend',   index: 'time.end', jsonmap: 'time.end', formatter: self._formatters.date, width: 145, fixed: true}


Then I get the "TypeError: value is undefined" error. It seems that the time field is not being passed properly to the formatter. The other fields (options and row) are set correctly, just the "value" field is undefined.


Any ideas?


Thanks,

Keith

22:42
04/06/2012


hughitt1

Member

posts 17

Quick update –


When I removed the formatters, the row is succesfully added, but the 'start' and 'end' columns corresponding with time.start and time.end are empty.


It looks like the problem may be with hierarchical > 1 depth column mappings and addRowData?

10:01
05/06/2012


tony

Sofia, Bulgaria

Moderator

posts 7043

Post edited 10:02 – 05/06/2012 by tony


Hello,


You can not do this using addRowData.

The way to do this is to use data parameter and jsonmap property of colModel (see docs).


Also how you previous add this data?

If you allwas want to use addRowData and have

var new_row = [{"time":{"end":"20120507235959","start":"20120507000000"}];

then you can easy reconstruct this

to

var new_row = [{"timeend":"20120507235959","timestart":"20120507000000"}];

which will work.


Regards


No Tags

About the jQuery Grid Plugin – jqGrid forum

Most Users Ever Online:

157


Currently Online:

samraj

87 Guests

Forum Stats:

Groups: 1

Forums: 7

Topics: 9660

Posts: 28947

Membership:

There are 10354 Members

There have been 448 Guests

There is 1 Admin

There are 2 Moderators

Top Posters:

OlegK – 1167

markw65 – 179

kobruleht – 144

phicarre – 126

YamilBracho – 124

Renso – 118

Administrators: admin (56 Posts)

Moderators: tony (7043 Posts), Rumen[Trirand] (81 Posts)




Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information