PDA

View Full Version : How to give multiples values with JSON in a Grid



same66
27 Dec 2010, 2:17 AM
Hi,

i'm creating a grid with json but, i don't know how to give multiple values in my JSON.

Here is my JSON :



{
"id" : 3,
"fieldName" : "number",
"enable" : false,
"isVisible" : true,
"label" : "Number",
"fieldLength" : 80
},
{
"id" : 4,
"fieldName" : "description",
"enable" : false,
"isVisible" : true,
"label" : "Description",
"fieldLength" : 60
}
],
"data" : [
{
"Number" : "1",
"description" : "Test1"
},
{
"Number" : "2",
"description" : "Test2"
},...


But this method, don't allows to give multiple data for my number column in a specific row.

For exemple, i want to give to my line 4 (random) and column description the following datas :

"Number" : [{color:'yellow', value:'test1'}]

It is possible to do that ?

Sorry if is difficult to understand my problem :(

Thanks :)

Condor
27 Dec 2010, 2:37 AM
1. Are you using that metadata in your JSON?
2. What is stopping you from assigning that value to the "Number" property?

same66
27 Dec 2010, 2:54 AM
Hello :)


1. Are you using that metadata in your JSON?

What is this ?


2. What is stopping you from assigning that value to the "Number" property?

I don't know how to get that value in my extJS code :(

realy thanks for your reply :)

Condor
27 Dec 2010, 3:38 AM
1. What are you using this for:

{
"id" : 3,
"fieldName" : "number",
"enable" : false,
"isVisible" : true,
"label" : "Number",
"fieldLength" : 80
},
{
"id" : 4,
"fieldName" : "description",
"enable" : false,
"isVisible" : true,
"label" : "Description",
"fieldLength" : 60
}

2. Do what? Just specify your data as:

{
"Number" : [{color:'yellow', value:'test1'}],
"description" : "Test1"
},
ps. Should that really be an array?

same66
27 Dec 2010, 5:26 AM
In fact,
I'm trying to do that :

http://img138.imageshack.us/i/graphk.jpg/

And, I'm using a grid component.
And now, I want to create the renderer to cut my column in multiple rectangles etc...

But my problem is how to get that value for my grid.

It's ok when I want create my column model with data (create the number column, and the description column), but when I want to add for each line different values, I'm lost :(

same66
27 Dec 2010, 6:02 AM
HOOO,

i'm so bad...

To get my data I use the renderer !

var color = record.data.description.color;

HOP :D

thanks :D