Trying to load data that is being passed by using a store

青春壹個敷衍的年華 提交于 2019-12-19 11:57:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!