Forum


20:23

22/12/2008

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

Moderators
30/10/2007

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.
21:38

22/12/2008

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
03:35

Moderators
30/10/2007

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.
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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66