Hi all
I need to create datagrid columns "on the fly".
Here is what I have:
$.get("/json/members_tabs.json",
{
}).done(function(data)
{
$('#member_invoice').datagrid({
url:'/json/member_invoice.json',
columns: [[{field:"_date",title:"Date"},{field:"document",title:"Name"},{field:"shipping",title:"Price",align:"right"}]]
//columns: data
});
});
my "data" contain same value as above, but it does not work.
Why not?
I mean, if I use this:
columns: data
and inside "data" is this:
[[{field:"_date",title:"Date"},{field:"document",title:"Name"},{field:"shipping",title:"Price",align:"right"}]]
it will not work, and if I use this:
columns: [[{field:"_date",title:"Date"},{field:"document",title:"Name"},{field:"shipping",title:"Price",align:"right"}]]
it works.
What I need to do so I can create columns on the fly?
I found this answer:
http://www.jeasyui.com/forum/index.php?topic=286.msg681#msg681but it is same as above - If I use my data instead od "hardcoded" values - it does not work.
Thanks for help.