当前位置: 动力学知识库 > 问答 > 编程问答 >

ajax - Extjs 5 Ext.app.ViewModel, stores - load data using proxy

问题描述:

I'm trying load data from server and bind data. Such method does not work. Whats wrong?

Ext.define('Configurator.view.activityType.ActivityTypeModel', {

extend: 'Ext.app.ViewModel',

alias: 'viewmodel.activityTypeModel',

stores: {

ticketStatusSummary: {

fields: ['id', 'title', 'name'],

autoLoad: true,

proxy: {

url: '{prefix}/{entityName:uncapitalize}',

pageParam: '{pagaParam}',

startParam: '{startParam}',

limitParam: '{limitParam}'

} }

}

...

网友答案:

Problem is resolve. Problem is with the proxy - unknown reader

reader: {
            type: 'json',           
         }

Actual code:

Ext.define('Configurator.view.activityType.ActivityTypeModel', {
    extend: 'Ext.app.ViewModel',
    alias: 'viewmodel.activityTypeModel',
    stores: {
      ticketStatusSummary: {
       fields: ['id', 'title', 'name'],
       autoLoad: true,
       proxy: {
                url: '{prefix}/{entityName:uncapitalize}',
                pageParam: '{pagaParam}',
                startParam: '{startParam}',
                limitParam: '{limitParam}',
                reader: {
                        type: 'json',           
                }
            }  
        }
    }
... 
网友答案:

Im surprised that you have to define all of this inside your viewcontroller...

You should be able to do: (I'm still trying to actually figure this out, I dont think it is the right code.)

stores:{
    ticketSummary:'MyApp.stores.TicketSummary'
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: