All, I am having difficulty loading the grid using a data store. When I manually .parse the data the grid loads fine but when I use the .sync with a DataStore it does not. Any help is appreciated. Thanks Nick
BTW… I am evaluating the PRO edition.
Here is a snippet of code of initializing my grid, below is commented out code that works and below that is the code that does not.
// Create a grid object by attaching it to cell "a" of the layout. Attaching an object
// to another object creates the object being attached all in one step.
contactsGrid = layout.cells("a").attachGrid();
contactsGrid.setHeader("Name,Last Name,Email");
contactsGrid.setInitWidths("100,100,*");
contactsGrid.setColAlign("left,left,left");
contactsGrid.setColTypes("ro,ro,ro");
contactsGrid.setColSorting("str,str,str");
contactsGrid.setColumnIds("firstName,lastName,email");
// Add filtering to the grid.
contactsGrid.attachHeader("#text_filter,#text_filter,#text_filter");
// Initialize the grid.
contactsGrid.init();
// THE COMMENTED OUT CODE WORKS AND LOADS THE GRID.
// Hard code some data.
//var data = {
// rows: [{
// id: 1091,
// data: ["Nick", "Vujasin", "nick_vujasin@yahoo.com"]
// }, {
// id: 1092,
// data: ["Pete", "Tutera", "pete_tutera@cfd.com"]
// }]
//}
// Load the data into the grid.
//contactsGrid.parse(data, "json");
// THIS DOES NOT WORK AND DOES NOT LOAD THE GRID.
var myDataStore = new dhtmlXDataStore();
myDataStore.parse([
{"id":"1", "firstName":"Nick", "lastName":"Vujasin","email":"nick_vujasin@yahoo.com"},
{"id":"2", "firstName":"Pete", "lastName":"Tutera","email":"pete_tutera@cfd.com"}]);
contactsGrid.sync(myDataStore);