$$('grid').add() using a variable

I have made a grid which contains two columns ‘No’ and ‘Name’.
Now one way to add is

$$(‘grid’).add({No:“1”,Name:“Teddy”});

But if I go this way
var addQuery="{No:“1”,Name:“Teddy”}";
$$(‘grid’).add(addQuery);

Then it doesn’t work. I have to use addQuery variable. So then how should I proceed ?
Reply.
Thank you.

It must be

  var addQuery={No:"1",Name:"Teddy"};

without extra quotes.

Thanks.
But there is a some problem now. Actually I was building that string dynamically using a loop.
So I did

var addQuery="{"+colHeader+":"+"""+value+""";
for loop
{

}
addQuery=addQuery+"}";

Then I used
$$(‘grid’).add(addQuery);
But I didn’t succeed.

Then I tried
var addQuery=colHeader+":"+"""+value+""";
for loop{…}

var newQuery={addQuery};…(Gives Error on this line)
$$(‘grid’).add(newQuery);
But it gives error on the above shown line.

How can I proceed ?
Please reply.
Thank you.

If you want to load from string you can use

var new_data_as_string= "[{ ... some data ... }]"; $$('grid').parse(new_data_as_string);
but object creation is more correct way

var addQuery={ colHeader: value }; for loop { ....... addQuery[some] = some_value; } $$('grid').add(addQuery);

Ya its working. Thank you. But I did not understand the working.
What is the need and meaning of the sentence mentioned below ?
var addQuery={ colHeader: value };
Thanks once again

var addQuery={ colHeader: value };
This line create new data object, basically instead of creating the string with object description, you can create object directly and use “add” command to load it in the component

Thanks a lot. I am done with the final year project.
Thanks a lot for helping me so much.
I must tell say this framework is awesome…Simply awesome.
Bye Bye.