Similar to this Stack Overflow question, my issue involves loading JSON data into a new window. I want the structure of the new window to be like this example. The challenge is combining the solutions for reading JSON and creating a grid in a new window, so that the grid can display the JSON data passed to it. How should I modify the store line in the second code block (or in my own code below) to read from a variable containing my JSON data?
var obj = response;
try {
obj = Ext.decode(response.responseText);
} catch (error) {}
if (obj) {
Ext.create('Ext.window.Window', {
title: 'Hello',
height: 200,
width: 400,
layout: 'fit',
items: {
xtype: 'grid',
border: false,
columns: [{
text: 'id',
flex: 1,
sortable: true,
dataIndex: 'id'
}, {
text: 'name',
width: 300,
sortable: true,
dataIndex: 'name'
}],
store: Ext.create('Ext.data.ArrayStore', {}) //this is the line I have to change
}
}).show();
} else {
alert("Invalid response")
}