问题
I am trying to get data that is being passed and load it into various textfields. Right now, I have a .html file which contains this:
<script type="text/javascript">
var res = {"address":"","city":"","state":"","zip":""};
</script>
Then, I have a .js file which contains my entire layout with all the textfields, etc. and my entire store. This is what I have so far as my store trying to load the data, but I am not sure what the correct method is to try and get the data from the html file and display it on my js file.
var newStore= new Ext.data.ArrayStore({
fields: ['address', 'city', 'state', 'zip'],
loadData: (res),
idIndex: 0
});
Could someone please help me as I am a bit lost on what to do?
回答1:
Try ArrayStore Like this.
var newStore= new Ext.data.ArrayStore({
fields: ['address', 'city', 'state', 'zip']
});
newStore.add(res);
newStore.commitChanges()
This should work.
来源:https://stackoverflow.com/questions/18513434/trying-to-load-data-that-is-being-passed-by-using-a-store