I'm trying to use EditableGrid with data in json format that is inside the script itself, but I'm getting error messages.
This is using the latest code from Github so it's supposedly version 3.0
Any ideas? Thanks in advance.
Code sample:
var jsonData = {
"metadata":[
{"name":"name","label":"NAME","datatype":"string","editable":true},
{"name":"firstname","label":"FIRSTNAME","datatype":"string","editable":true},
{"name":"age","label":"AGE","datatype":"integer","editable":true},
{"name":"height","label":"HEIGHT","datatype":"double(m,2)","editable":true},
{"name":"country","label":"COUNTRY","datatype":"string","editable":true,"values":
{
"Europe":{"be":"Belgium","fr":"France","uk":"Great-Britain","nl":"Nederland"},
"America":{"br":"Brazil","ca":"Canada","us":"USA"},
"Africa":{"ng":"Nigeria","za":"South-Africa","zw":"Zimbabwe"}}
},
{"name":"email","label":"EMAIL","datatype":"email","editable":true},
{"name":"freelance","label":"FREELANCE","datatype":"boolean","editable":true},
{"name":"lastvisit","label":"LAST VISIT","datatype":"date","editable":true}
],
"data":[
{"id":1, "values":{"country":"uk","age":33,"name":"Duke","firstname":"Patience","height":1.842,"email":"[email protected]","lastvisit":"11\/12\/2002"}},
{"id":2, "values":["Rogers","Denise",59,1.627,"us","[email protected]","","07\/05\/2003"]},
{"id":3, "values":{"name":"Dujardin","firstname":"Antoine","age":21,"height":1.73,"country":"fr","email":"[email protected]","freelance":true,"lastvisit":"21\/02\/1999"}},
{"id":4, "values":{"name":"Conway","firstname":"Coby","age":47,"height":1.96,"country":"za","email":"[email protected]","freelance":true,"lastvisit":"01\/12\/2007"}},
{"id":5, "values":{"name":"Shannon","firstname":"Rana","age":24,"height":1.56,"country":"nl","email":"[email protected]","freelance":false,"lastvisit":"07\/10\/2009"}},
{"id":6, "values":{"name":"Benton","firstname":"Jasmine","age":61,"height":1.71,"country":"ca","email":"[email protected]","freelance":false,"lastvisit":"13\/01\/2009"}},
{"id":7, "values":{"name":"Belletoise","firstname":"André","age":31,"height":1.84,"country":"be","email":"[email protected]","freelance":true,"lastvisit":""}},
{"id":8, "values":{"name":"Santa-Maria","firstname":"Martin","age":37,"height":1.80,"country":"br","email":"[email protected]","freelance":false,"lastvisit":"12\/06\/1995"}},
{"id":9, "values":{"name":"Dieumerci","firstname":"Amédé","age":37,"height":1.81,"country":"ng","email":"[email protected]","freelance":true,"lastvisit":"05\/07\/2009"}},
{"id":10,"values":{"name":"Morin","firstname":"Wanthus","age":46,"height":1.77,"country":"zw","email":"[email protected]","freelance":false,"lastvisit":"04\/03\/2004"}}
]};
$(function() {
editableGrid = new EditableGrid("EdiTable");
editableGrid.load(jsonData);
editableGrid.renderGrid("tablecontent");
});
The html code contains a div with id=tablecontent