I have a hash map dataFields = {"element1":1,"element2":2,"element3":3}
and I am trying to display the data in a dojo grid. However, when I set up my data store like:
var data = { identifier: "element1",
items: []
};
payload = JSON.stringify(dataFields);
data.items.push(payload);
var store = new dojo.data.ItemFileWriteStore({data: data});
the grid does not display anything. Now I know that the grid is set up correctly because when I pass in a JSON file to test my grid it displays the contents of the file without any errors.
I should mention that dataFields
is a response of a GET
and the entire response is not useful to me that is why I extract the useful fields and put them in a hash map and try to display them. I feel like I am missing something essential here regarding how the data stores work. So I guess, the right question to ask is, how would I setup my data store so that the grid displays my hash map? Or is there a better way to do it than using a hash map?