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_TopicIcon
JSON Data Type Problem
21/12/2008
20:23
Avatar
River
New Member
Members
Forum Posts: 2
Member Since:
22/12/2008
sp_UserOfflineSmall Offline

Hi,

I have a json string like this

{"d":{"total":2,"page":1,"records":10,"rows":[{"invid":1,"invdate":2,"amount":20,"tax":15,"total":false,"note":"this is a test"}]}}

and the grid setting is

        var option = {
                //mtype:"POST",
                //url: "Default.aspx/GetData",
                datatype: 'local',
                colNames: ['Inv No', 'Date', 'Amount', 'Tax', 'Total', 'Notes'],
                colModel: [
                                    { name: 'invid', index: 'invid', width: 55, jsonmap: "invid" },
                                    { name: 'invdate', index: 'invdate', width: 90, jsonmap: "invdate" },
                                    { name: 'amount', index: 'amount', width: 80, align: 'right', jsonmap: "amount" },
                                    { name: 'tax', index: 'tax', width: 80, align: 'right', jsonmap: "tax" },
                                    { name: 'total', index: 'total', width: 80, jsonmap: "total" },
                                    { name: 'note', index: 'note', width: 150, sortable: false, jsonmap: "note"}],
                pager: jQuery('#pager'),
                rowNum: 10,
                rowList: [10, 20, 30],
                sortname: 'id',
                sortorder: 'desc',
                viewrecords: true,
                imgpath: 'themes/basic/images',
                caption: 'My first grid',
                jsonReader: {
                    repeatitems : false,
                    id: "0"
                }
            };

It cause an error in jQuery1.2.6.js line 255

252 append: function() {
253 return this.domManip(arguments, true, false, function(elem){
254 if (this.nodeType == 1)
255 this.appendChild( elem );
256 });
257 },
and the value of elem is false.
how can I solve the problem without change the JSON string ??
Thanks
River
23/12/2008
03:30
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

I will check this, but this causes the following when the data is added $(tabledataelem).html(false) - I'm not sure if this is correct . If possible try to set "total" : "false".

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.

24/12/2008
21:38
Avatar
River
New Member
Members
Forum Posts: 2
Member Since:
22/12/2008
sp_UserOfflineSmall Offline

Thanks tony,

I'm using ado.net Entity framework as the datasource

it will generate the json string while it return

 "total":false  is the result. 

and "CREATEDTTM":"\\/Date(1229862650797)\\/" while the data type is DateTime.

Is there any possible to support this kind of data type??

Right now, I have a solution to solve the problem.

I made some modification to grid.base.js

in function addCell I add these code

                if (cell != ' ' && p.colModel[pos].render) {
                    cell = p.colModel[pos].render(cell );
                }

then I can have the display text I want in the colModel definition

29/12/2008
03:35
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Maybe the easy way (which I should test) is

cell = cell +"";

before inserteding.

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:
30 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