Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sencha touch 表格+;提交后不显示嵌套列表_Sencha Touch_Extjs - Fatal编程技术网

Sencha touch 表格+;提交后不显示嵌套列表

Sencha touch 表格+;提交后不显示嵌套列表,sencha-touch,extjs,Sencha Touch,Extjs,我只是在学习sencha touch 2,MVC。我想制作一个简单的表单,获取一个值,传递到一个PHP文件(对于web服务的API调用),移动到一个嵌套列表并显示结果。 但是,我的应用程序在提交后没有显示任何内容。。。值被正确捕获(我在控制台日志中看到)。 有人能帮我吗 考虑一下测试,目前我不传递值,我的API调用直接使用硬编码值进行调用。将来我会努力传递表单值 提前谢谢你 这是“app.js” 这是“搜索上限”表格 这是控制器 Ext.define('Appre.controller.Sear

我只是在学习sencha touch 2,MVC。我想制作一个简单的表单,获取一个值,传递到一个PHP文件(对于web服务的API调用),移动到一个嵌套列表并显示结果。 但是,我的应用程序在提交后没有显示任何内容。。。值被正确捕获(我在控制台日志中看到)。 有人能帮我吗

考虑一下测试,目前我不传递值,我的API调用直接使用硬编码值进行调用。将来我会努力传递表单值

提前谢谢你

这是“app.js”

这是“搜索上限”表格

这是控制器

Ext.define('Appre.controller.SearchCap', {
extend : "Ext.app.Controller",
config : {
    refs : {
        btnSubmitLogin: 'button[action=searchCap]',
        form : 'appre-searchCap'
    },
    control : {
        btnSubmitLogin : {
            tap : "onSubmitLogin"
        }
    }
},
onSubmitLogin : function() {
    console.log("onSubmitLogin");
    var values = this.getForm().getValues();
    console.log(values);
    var $this=this;
    Ext.Ajax.request({
        url: 'cerca-ristoranti-cap.php',
        method: 'POST',
        params: {
            values: Ext.encode({form_fields: values})
        },
        success: function(response, opts) {
            var obj = Ext.decode(response.responseText);
            //Ext.Msg.alert('Contact Complete!', obj.responseText);
            $this.resetForm();
            Ext.Viewport.add(Ext.create('Appre.view.ElencoRistoranti'));
            Ext.Viewport.setActiveItem(Ext.create('Appre.view.ElencoRistoranti'));
        },
        failure: function(response, opts) {
            console.log('server-side failure with status code ' + response.status);
        }
    });
},
resetForm: function() {
this.getForm().reset();
},
    launch : function() {
        this.callParent();
        console.log("LoginForm launch");
    },
    init : function() {
        this.callParent();
        console.log("LoginForm init");
    }
});
这是嵌套列表

Ext.define('Appre.view.ElencoRistoranti', {
extend: 'Ext.Panel',
xtype: 'appre-elencoristoranti',
config: {
    xtype: 'nestedlist',
    title: 'Cap',
    displayField: 'name',
    store: {
        type: 'tree',
        fields: [
            'id_restaurant', 'name',
            {name: 'leaf', defaultValue: true}
        ],
        root: {
            leaf: false
        },
        proxy: {
            type: 'ajax',
            url: 'cerca-ristoranti-cap.php',
            reader: {
                type: 'json',
                rootProperty: 'restaurants'
            } //reader
        } // proxy
    },
    detailCard: {
        xtype: 'panel',
        scrollable: true,
        styleHtmlContent: true
    },
    listeners: {
        itemtap: function(nestedList, list, index, element, post) {
            this.getDetailCard().setHtml(post.get('name'));
        }
    }
} // config
});
cerca-ristoranti-cap.php这是一个返回如下数组的简单函数:

{
"restaurants":[{
    "id_restaurant":"40",
    "name":"La Saliera",
    "zip":"00128",
    "lat":"41.7900229",
    "lgt":"12.4513128"
}, {
    "id_restaurant":"64",
    "name":"Osteria del Borgo",
    "zip":"00128",
    "lat":"41.7887363",
    "lgt":"12.5149867"
}]

}

嗨@Sinerba很抱歉反应有点晚,但这里有一些你想展示的东西

Viewport.js

Ext.define('myapp.view.Viewport' , {
  extend : 'Ext.viewport.Default',
  xtype : "viewport",
  config: {
    fullscreen: true,
    styleHtmlContent: true,
    style: 'background:#ffffff;',
    layout : 'card',
    autoDestroy : false,
    cardSwitchAnimation : 'slide',

    items: [
       {
          xtype: 'appre-searchCap'
       },
    ],
  }
})
Ext.Loader.setConfig({
  enabled: true
})

Ext.application({
    name: 'myapp',
    requires: [
         'myapp.view.SearchCap',
         'myapp.view.ElencoRistoranti',
         'myapp.view.SearchElenco',
    ],
    controllers: ['SearchCap'],
    models: ['myapp.model.SearchCapModel'],
    launch: function() {
         Ext.create('myapp.view.Viewport')
    }
});
Ext.define('myapp.model.SearchCapModel', {
    extend: 'Ext.data.Model',
    config: {
         idProperty: 'id_restaurant',
         fields: [
             { name: 'id_restaurant', type: 'string' },
             { name: 'name', type: 'string'},
             { name: 'zip', type: 'string' },
             { name: 'lat', type: 'string'},
             { name: 'lgt', type: 'string'}
        ],
   }
})
Ext.define('myapp.store.SearchCapStore', {
    extend: 'Ext.data.Store',
    config: {
         model: 'myapp.model.SearchCapModel',
         autoLoad: true,
         proxy: {
             type: 'ajax',
             url : 'cerca-ristoranti-cap.json',
             reader: {
                   type: 'json',
                   rootProperty: 'restaurants'
             } //reader
         },
   }
});
Ext.define('myapp.controller.SearchCap', {
    extend : "Ext.app.Controller",

    views: ['SearchElenco'],

    config : {
         refs : {
             elencoListContainer: 'elencolistcontainer',
             btnSubmitLogin: 'button[action=searchCap]',
             form : 'appre-searchCap',
         },
         control : {
               btnSubmitLogin : {
                      tap : "onSubmitLogin"
               }
         }
    },
    onSubmitLogin : function() {
            console.log("onSubmitLogin");
            var values = this.getForm().getValues();
            console.log(values);

            Ext.Ajax.request({
                    url: 'cerca-ristoranti-cap.json',
                    method: 'POST',
                    params: {
                         values: Ext.encode({form_fields: values})
                    },
                    success: function(response, opts) {
                            var obj = response.responseText;
                            Ext.Msg.alert('Contact Complete!', obj);
                            Ext.Viewport.add(Ext.create('myapp.view.SearchElenco'));
                            Ext.Viewport.setActiveItem(1);
                    },
                    failure: function(response, opts) {
                          console.log('server-side failure with status code ' + response.status);
                    }
            });
    },
    resetForm: function() {
            this.getForm().reset();
    },
    launch : function() {
            this.callParent();
            console.log("LoginForm launch");
    },
    init : function() {
            this.callParent();
            console.log("LoginForm init");
    }
});
Ext.define('myapp.view.SearchElenco', {
    extend: 'Ext.Container',
    xtype: 'elencolistcontainer',

    requires: ['myapp.store.SearchCapStore'],

    initialize: function() {
            this.callParent(arguments);

            var s = Ext.create('myapp.store.SearchCapStore')
            var notesList = {
                    xtype: 'appre-elencoristoranti',
                    store: Ext.getStore(s).setAutoLoad(true),
                    listeners: {
                           disclose: {
                                    fn: this.onNotesListDisclose,
                                    scope: this
                           }
                    }
            };
            this.add([notesList])
    },
    onNotesListDisclose: function(list, record, target, index, event, options) {
            console.log('editNoteCommand');
            this.fireEvent('editNoteCommand', this, record);
    },

     config: {
           layout: {
                 type: 'fit'
           }
     }
});
Ext.define('myapp.view.ElencoRistoranti', {
    extend: 'Ext.dataview.List',
    xtype: 'appre-elencoristoranti',
    id: 'appreElenco',

    config: {
       emptyText: '<pre><div class="notes-list-empty-text">No list found.</div></pre>',
       onItemDisclosure: false,
       itemTpl: '<pre><div class="list-item-title">{id_restaurant}</div><div class="list-item-narrative">{name}</div></pre>',
    }
});
app.js

Ext.define('myapp.view.Viewport' , {
  extend : 'Ext.viewport.Default',
  xtype : "viewport",
  config: {
    fullscreen: true,
    styleHtmlContent: true,
    style: 'background:#ffffff;',
    layout : 'card',
    autoDestroy : false,
    cardSwitchAnimation : 'slide',

    items: [
       {
          xtype: 'appre-searchCap'
       },
    ],
  }
})
Ext.Loader.setConfig({
  enabled: true
})

Ext.application({
    name: 'myapp',
    requires: [
         'myapp.view.SearchCap',
         'myapp.view.ElencoRistoranti',
         'myapp.view.SearchElenco',
    ],
    controllers: ['SearchCap'],
    models: ['myapp.model.SearchCapModel'],
    launch: function() {
         Ext.create('myapp.view.Viewport')
    }
});
Ext.define('myapp.model.SearchCapModel', {
    extend: 'Ext.data.Model',
    config: {
         idProperty: 'id_restaurant',
         fields: [
             { name: 'id_restaurant', type: 'string' },
             { name: 'name', type: 'string'},
             { name: 'zip', type: 'string' },
             { name: 'lat', type: 'string'},
             { name: 'lgt', type: 'string'}
        ],
   }
})
Ext.define('myapp.store.SearchCapStore', {
    extend: 'Ext.data.Store',
    config: {
         model: 'myapp.model.SearchCapModel',
         autoLoad: true,
         proxy: {
             type: 'ajax',
             url : 'cerca-ristoranti-cap.json',
             reader: {
                   type: 'json',
                   rootProperty: 'restaurants'
             } //reader
         },
   }
});
Ext.define('myapp.controller.SearchCap', {
    extend : "Ext.app.Controller",

    views: ['SearchElenco'],

    config : {
         refs : {
             elencoListContainer: 'elencolistcontainer',
             btnSubmitLogin: 'button[action=searchCap]',
             form : 'appre-searchCap',
         },
         control : {
               btnSubmitLogin : {
                      tap : "onSubmitLogin"
               }
         }
    },
    onSubmitLogin : function() {
            console.log("onSubmitLogin");
            var values = this.getForm().getValues();
            console.log(values);

            Ext.Ajax.request({
                    url: 'cerca-ristoranti-cap.json',
                    method: 'POST',
                    params: {
                         values: Ext.encode({form_fields: values})
                    },
                    success: function(response, opts) {
                            var obj = response.responseText;
                            Ext.Msg.alert('Contact Complete!', obj);
                            Ext.Viewport.add(Ext.create('myapp.view.SearchElenco'));
                            Ext.Viewport.setActiveItem(1);
                    },
                    failure: function(response, opts) {
                          console.log('server-side failure with status code ' + response.status);
                    }
            });
    },
    resetForm: function() {
            this.getForm().reset();
    },
    launch : function() {
            this.callParent();
            console.log("LoginForm launch");
    },
    init : function() {
            this.callParent();
            console.log("LoginForm init");
    }
});
Ext.define('myapp.view.SearchElenco', {
    extend: 'Ext.Container',
    xtype: 'elencolistcontainer',

    requires: ['myapp.store.SearchCapStore'],

    initialize: function() {
            this.callParent(arguments);

            var s = Ext.create('myapp.store.SearchCapStore')
            var notesList = {
                    xtype: 'appre-elencoristoranti',
                    store: Ext.getStore(s).setAutoLoad(true),
                    listeners: {
                           disclose: {
                                    fn: this.onNotesListDisclose,
                                    scope: this
                           }
                    }
            };
            this.add([notesList])
    },
    onNotesListDisclose: function(list, record, target, index, event, options) {
            console.log('editNoteCommand');
            this.fireEvent('editNoteCommand', this, record);
    },

     config: {
           layout: {
                 type: 'fit'
           }
     }
});
Ext.define('myapp.view.ElencoRistoranti', {
    extend: 'Ext.dataview.List',
    xtype: 'appre-elencoristoranti',
    id: 'appreElenco',

    config: {
       emptyText: '<pre><div class="notes-list-empty-text">No list found.</div></pre>',
       onItemDisclosure: false,
       itemTpl: '<pre><div class="list-item-title">{id_restaurant}</div><div class="list-item-narrative">{name}</div></pre>',
    }
});
SearchCapModel.js

Ext.define('myapp.view.Viewport' , {
  extend : 'Ext.viewport.Default',
  xtype : "viewport",
  config: {
    fullscreen: true,
    styleHtmlContent: true,
    style: 'background:#ffffff;',
    layout : 'card',
    autoDestroy : false,
    cardSwitchAnimation : 'slide',

    items: [
       {
          xtype: 'appre-searchCap'
       },
    ],
  }
})
Ext.Loader.setConfig({
  enabled: true
})

Ext.application({
    name: 'myapp',
    requires: [
         'myapp.view.SearchCap',
         'myapp.view.ElencoRistoranti',
         'myapp.view.SearchElenco',
    ],
    controllers: ['SearchCap'],
    models: ['myapp.model.SearchCapModel'],
    launch: function() {
         Ext.create('myapp.view.Viewport')
    }
});
Ext.define('myapp.model.SearchCapModel', {
    extend: 'Ext.data.Model',
    config: {
         idProperty: 'id_restaurant',
         fields: [
             { name: 'id_restaurant', type: 'string' },
             { name: 'name', type: 'string'},
             { name: 'zip', type: 'string' },
             { name: 'lat', type: 'string'},
             { name: 'lgt', type: 'string'}
        ],
   }
})
Ext.define('myapp.store.SearchCapStore', {
    extend: 'Ext.data.Store',
    config: {
         model: 'myapp.model.SearchCapModel',
         autoLoad: true,
         proxy: {
             type: 'ajax',
             url : 'cerca-ristoranti-cap.json',
             reader: {
                   type: 'json',
                   rootProperty: 'restaurants'
             } //reader
         },
   }
});
Ext.define('myapp.controller.SearchCap', {
    extend : "Ext.app.Controller",

    views: ['SearchElenco'],

    config : {
         refs : {
             elencoListContainer: 'elencolistcontainer',
             btnSubmitLogin: 'button[action=searchCap]',
             form : 'appre-searchCap',
         },
         control : {
               btnSubmitLogin : {
                      tap : "onSubmitLogin"
               }
         }
    },
    onSubmitLogin : function() {
            console.log("onSubmitLogin");
            var values = this.getForm().getValues();
            console.log(values);

            Ext.Ajax.request({
                    url: 'cerca-ristoranti-cap.json',
                    method: 'POST',
                    params: {
                         values: Ext.encode({form_fields: values})
                    },
                    success: function(response, opts) {
                            var obj = response.responseText;
                            Ext.Msg.alert('Contact Complete!', obj);
                            Ext.Viewport.add(Ext.create('myapp.view.SearchElenco'));
                            Ext.Viewport.setActiveItem(1);
                    },
                    failure: function(response, opts) {
                          console.log('server-side failure with status code ' + response.status);
                    }
            });
    },
    resetForm: function() {
            this.getForm().reset();
    },
    launch : function() {
            this.callParent();
            console.log("LoginForm launch");
    },
    init : function() {
            this.callParent();
            console.log("LoginForm init");
    }
});
Ext.define('myapp.view.SearchElenco', {
    extend: 'Ext.Container',
    xtype: 'elencolistcontainer',

    requires: ['myapp.store.SearchCapStore'],

    initialize: function() {
            this.callParent(arguments);

            var s = Ext.create('myapp.store.SearchCapStore')
            var notesList = {
                    xtype: 'appre-elencoristoranti',
                    store: Ext.getStore(s).setAutoLoad(true),
                    listeners: {
                           disclose: {
                                    fn: this.onNotesListDisclose,
                                    scope: this
                           }
                    }
            };
            this.add([notesList])
    },
    onNotesListDisclose: function(list, record, target, index, event, options) {
            console.log('editNoteCommand');
            this.fireEvent('editNoteCommand', this, record);
    },

     config: {
           layout: {
                 type: 'fit'
           }
     }
});
Ext.define('myapp.view.ElencoRistoranti', {
    extend: 'Ext.dataview.List',
    xtype: 'appre-elencoristoranti',
    id: 'appreElenco',

    config: {
       emptyText: '<pre><div class="notes-list-empty-text">No list found.</div></pre>',
       onItemDisclosure: false,
       itemTpl: '<pre><div class="list-item-title">{id_restaurant}</div><div class="list-item-narrative">{name}</div></pre>',
    }
});
SearchCapStore.js

Ext.define('myapp.view.Viewport' , {
  extend : 'Ext.viewport.Default',
  xtype : "viewport",
  config: {
    fullscreen: true,
    styleHtmlContent: true,
    style: 'background:#ffffff;',
    layout : 'card',
    autoDestroy : false,
    cardSwitchAnimation : 'slide',

    items: [
       {
          xtype: 'appre-searchCap'
       },
    ],
  }
})
Ext.Loader.setConfig({
  enabled: true
})

Ext.application({
    name: 'myapp',
    requires: [
         'myapp.view.SearchCap',
         'myapp.view.ElencoRistoranti',
         'myapp.view.SearchElenco',
    ],
    controllers: ['SearchCap'],
    models: ['myapp.model.SearchCapModel'],
    launch: function() {
         Ext.create('myapp.view.Viewport')
    }
});
Ext.define('myapp.model.SearchCapModel', {
    extend: 'Ext.data.Model',
    config: {
         idProperty: 'id_restaurant',
         fields: [
             { name: 'id_restaurant', type: 'string' },
             { name: 'name', type: 'string'},
             { name: 'zip', type: 'string' },
             { name: 'lat', type: 'string'},
             { name: 'lgt', type: 'string'}
        ],
   }
})
Ext.define('myapp.store.SearchCapStore', {
    extend: 'Ext.data.Store',
    config: {
         model: 'myapp.model.SearchCapModel',
         autoLoad: true,
         proxy: {
             type: 'ajax',
             url : 'cerca-ristoranti-cap.json',
             reader: {
                   type: 'json',
                   rootProperty: 'restaurants'
             } //reader
         },
   }
});
Ext.define('myapp.controller.SearchCap', {
    extend : "Ext.app.Controller",

    views: ['SearchElenco'],

    config : {
         refs : {
             elencoListContainer: 'elencolistcontainer',
             btnSubmitLogin: 'button[action=searchCap]',
             form : 'appre-searchCap',
         },
         control : {
               btnSubmitLogin : {
                      tap : "onSubmitLogin"
               }
         }
    },
    onSubmitLogin : function() {
            console.log("onSubmitLogin");
            var values = this.getForm().getValues();
            console.log(values);

            Ext.Ajax.request({
                    url: 'cerca-ristoranti-cap.json',
                    method: 'POST',
                    params: {
                         values: Ext.encode({form_fields: values})
                    },
                    success: function(response, opts) {
                            var obj = response.responseText;
                            Ext.Msg.alert('Contact Complete!', obj);
                            Ext.Viewport.add(Ext.create('myapp.view.SearchElenco'));
                            Ext.Viewport.setActiveItem(1);
                    },
                    failure: function(response, opts) {
                          console.log('server-side failure with status code ' + response.status);
                    }
            });
    },
    resetForm: function() {
            this.getForm().reset();
    },
    launch : function() {
            this.callParent();
            console.log("LoginForm launch");
    },
    init : function() {
            this.callParent();
            console.log("LoginForm init");
    }
});
Ext.define('myapp.view.SearchElenco', {
    extend: 'Ext.Container',
    xtype: 'elencolistcontainer',

    requires: ['myapp.store.SearchCapStore'],

    initialize: function() {
            this.callParent(arguments);

            var s = Ext.create('myapp.store.SearchCapStore')
            var notesList = {
                    xtype: 'appre-elencoristoranti',
                    store: Ext.getStore(s).setAutoLoad(true),
                    listeners: {
                           disclose: {
                                    fn: this.onNotesListDisclose,
                                    scope: this
                           }
                    }
            };
            this.add([notesList])
    },
    onNotesListDisclose: function(list, record, target, index, event, options) {
            console.log('editNoteCommand');
            this.fireEvent('editNoteCommand', this, record);
    },

     config: {
           layout: {
                 type: 'fit'
           }
     }
});
Ext.define('myapp.view.ElencoRistoranti', {
    extend: 'Ext.dataview.List',
    xtype: 'appre-elencoristoranti',
    id: 'appreElenco',

    config: {
       emptyText: '<pre><div class="notes-list-empty-text">No list found.</div></pre>',
       onItemDisclosure: false,
       itemTpl: '<pre><div class="list-item-title">{id_restaurant}</div><div class="list-item-narrative">{name}</div></pre>',
    }
});
SearchCap.js

Ext.define('myapp.view.Viewport' , {
  extend : 'Ext.viewport.Default',
  xtype : "viewport",
  config: {
    fullscreen: true,
    styleHtmlContent: true,
    style: 'background:#ffffff;',
    layout : 'card',
    autoDestroy : false,
    cardSwitchAnimation : 'slide',

    items: [
       {
          xtype: 'appre-searchCap'
       },
    ],
  }
})
Ext.Loader.setConfig({
  enabled: true
})

Ext.application({
    name: 'myapp',
    requires: [
         'myapp.view.SearchCap',
         'myapp.view.ElencoRistoranti',
         'myapp.view.SearchElenco',
    ],
    controllers: ['SearchCap'],
    models: ['myapp.model.SearchCapModel'],
    launch: function() {
         Ext.create('myapp.view.Viewport')
    }
});
Ext.define('myapp.model.SearchCapModel', {
    extend: 'Ext.data.Model',
    config: {
         idProperty: 'id_restaurant',
         fields: [
             { name: 'id_restaurant', type: 'string' },
             { name: 'name', type: 'string'},
             { name: 'zip', type: 'string' },
             { name: 'lat', type: 'string'},
             { name: 'lgt', type: 'string'}
        ],
   }
})
Ext.define('myapp.store.SearchCapStore', {
    extend: 'Ext.data.Store',
    config: {
         model: 'myapp.model.SearchCapModel',
         autoLoad: true,
         proxy: {
             type: 'ajax',
             url : 'cerca-ristoranti-cap.json',
             reader: {
                   type: 'json',
                   rootProperty: 'restaurants'
             } //reader
         },
   }
});
Ext.define('myapp.controller.SearchCap', {
    extend : "Ext.app.Controller",

    views: ['SearchElenco'],

    config : {
         refs : {
             elencoListContainer: 'elencolistcontainer',
             btnSubmitLogin: 'button[action=searchCap]',
             form : 'appre-searchCap',
         },
         control : {
               btnSubmitLogin : {
                      tap : "onSubmitLogin"
               }
         }
    },
    onSubmitLogin : function() {
            console.log("onSubmitLogin");
            var values = this.getForm().getValues();
            console.log(values);

            Ext.Ajax.request({
                    url: 'cerca-ristoranti-cap.json',
                    method: 'POST',
                    params: {
                         values: Ext.encode({form_fields: values})
                    },
                    success: function(response, opts) {
                            var obj = response.responseText;
                            Ext.Msg.alert('Contact Complete!', obj);
                            Ext.Viewport.add(Ext.create('myapp.view.SearchElenco'));
                            Ext.Viewport.setActiveItem(1);
                    },
                    failure: function(response, opts) {
                          console.log('server-side failure with status code ' + response.status);
                    }
            });
    },
    resetForm: function() {
            this.getForm().reset();
    },
    launch : function() {
            this.callParent();
            console.log("LoginForm launch");
    },
    init : function() {
            this.callParent();
            console.log("LoginForm init");
    }
});
Ext.define('myapp.view.SearchElenco', {
    extend: 'Ext.Container',
    xtype: 'elencolistcontainer',

    requires: ['myapp.store.SearchCapStore'],

    initialize: function() {
            this.callParent(arguments);

            var s = Ext.create('myapp.store.SearchCapStore')
            var notesList = {
                    xtype: 'appre-elencoristoranti',
                    store: Ext.getStore(s).setAutoLoad(true),
                    listeners: {
                           disclose: {
                                    fn: this.onNotesListDisclose,
                                    scope: this
                           }
                    }
            };
            this.add([notesList])
    },
    onNotesListDisclose: function(list, record, target, index, event, options) {
            console.log('editNoteCommand');
            this.fireEvent('editNoteCommand', this, record);
    },

     config: {
           layout: {
                 type: 'fit'
           }
     }
});
Ext.define('myapp.view.ElencoRistoranti', {
    extend: 'Ext.dataview.List',
    xtype: 'appre-elencoristoranti',
    id: 'appreElenco',

    config: {
       emptyText: '<pre><div class="notes-list-empty-text">No list found.</div></pre>',
       onItemDisclosure: false,
       itemTpl: '<pre><div class="list-item-title">{id_restaurant}</div><div class="list-item-narrative">{name}</div></pre>',
    }
});
SearchElenco.js

Ext.define('myapp.view.Viewport' , {
  extend : 'Ext.viewport.Default',
  xtype : "viewport",
  config: {
    fullscreen: true,
    styleHtmlContent: true,
    style: 'background:#ffffff;',
    layout : 'card',
    autoDestroy : false,
    cardSwitchAnimation : 'slide',

    items: [
       {
          xtype: 'appre-searchCap'
       },
    ],
  }
})
Ext.Loader.setConfig({
  enabled: true
})

Ext.application({
    name: 'myapp',
    requires: [
         'myapp.view.SearchCap',
         'myapp.view.ElencoRistoranti',
         'myapp.view.SearchElenco',
    ],
    controllers: ['SearchCap'],
    models: ['myapp.model.SearchCapModel'],
    launch: function() {
         Ext.create('myapp.view.Viewport')
    }
});
Ext.define('myapp.model.SearchCapModel', {
    extend: 'Ext.data.Model',
    config: {
         idProperty: 'id_restaurant',
         fields: [
             { name: 'id_restaurant', type: 'string' },
             { name: 'name', type: 'string'},
             { name: 'zip', type: 'string' },
             { name: 'lat', type: 'string'},
             { name: 'lgt', type: 'string'}
        ],
   }
})
Ext.define('myapp.store.SearchCapStore', {
    extend: 'Ext.data.Store',
    config: {
         model: 'myapp.model.SearchCapModel',
         autoLoad: true,
         proxy: {
             type: 'ajax',
             url : 'cerca-ristoranti-cap.json',
             reader: {
                   type: 'json',
                   rootProperty: 'restaurants'
             } //reader
         },
   }
});
Ext.define('myapp.controller.SearchCap', {
    extend : "Ext.app.Controller",

    views: ['SearchElenco'],

    config : {
         refs : {
             elencoListContainer: 'elencolistcontainer',
             btnSubmitLogin: 'button[action=searchCap]',
             form : 'appre-searchCap',
         },
         control : {
               btnSubmitLogin : {
                      tap : "onSubmitLogin"
               }
         }
    },
    onSubmitLogin : function() {
            console.log("onSubmitLogin");
            var values = this.getForm().getValues();
            console.log(values);

            Ext.Ajax.request({
                    url: 'cerca-ristoranti-cap.json',
                    method: 'POST',
                    params: {
                         values: Ext.encode({form_fields: values})
                    },
                    success: function(response, opts) {
                            var obj = response.responseText;
                            Ext.Msg.alert('Contact Complete!', obj);
                            Ext.Viewport.add(Ext.create('myapp.view.SearchElenco'));
                            Ext.Viewport.setActiveItem(1);
                    },
                    failure: function(response, opts) {
                          console.log('server-side failure with status code ' + response.status);
                    }
            });
    },
    resetForm: function() {
            this.getForm().reset();
    },
    launch : function() {
            this.callParent();
            console.log("LoginForm launch");
    },
    init : function() {
            this.callParent();
            console.log("LoginForm init");
    }
});
Ext.define('myapp.view.SearchElenco', {
    extend: 'Ext.Container',
    xtype: 'elencolistcontainer',

    requires: ['myapp.store.SearchCapStore'],

    initialize: function() {
            this.callParent(arguments);

            var s = Ext.create('myapp.store.SearchCapStore')
            var notesList = {
                    xtype: 'appre-elencoristoranti',
                    store: Ext.getStore(s).setAutoLoad(true),
                    listeners: {
                           disclose: {
                                    fn: this.onNotesListDisclose,
                                    scope: this
                           }
                    }
            };
            this.add([notesList])
    },
    onNotesListDisclose: function(list, record, target, index, event, options) {
            console.log('editNoteCommand');
            this.fireEvent('editNoteCommand', this, record);
    },

     config: {
           layout: {
                 type: 'fit'
           }
     }
});
Ext.define('myapp.view.ElencoRistoranti', {
    extend: 'Ext.dataview.List',
    xtype: 'appre-elencoristoranti',
    id: 'appreElenco',

    config: {
       emptyText: '<pre><div class="notes-list-empty-text">No list found.</div></pre>',
       onItemDisclosure: false,
       itemTpl: '<pre><div class="list-item-title">{id_restaurant}</div><div class="list-item-narrative">{name}</div></pre>',
    }
});
elencorristoranti.js

Ext.define('myapp.view.Viewport' , {
  extend : 'Ext.viewport.Default',
  xtype : "viewport",
  config: {
    fullscreen: true,
    styleHtmlContent: true,
    style: 'background:#ffffff;',
    layout : 'card',
    autoDestroy : false,
    cardSwitchAnimation : 'slide',

    items: [
       {
          xtype: 'appre-searchCap'
       },
    ],
  }
})
Ext.Loader.setConfig({
  enabled: true
})

Ext.application({
    name: 'myapp',
    requires: [
         'myapp.view.SearchCap',
         'myapp.view.ElencoRistoranti',
         'myapp.view.SearchElenco',
    ],
    controllers: ['SearchCap'],
    models: ['myapp.model.SearchCapModel'],
    launch: function() {
         Ext.create('myapp.view.Viewport')
    }
});
Ext.define('myapp.model.SearchCapModel', {
    extend: 'Ext.data.Model',
    config: {
         idProperty: 'id_restaurant',
         fields: [
             { name: 'id_restaurant', type: 'string' },
             { name: 'name', type: 'string'},
             { name: 'zip', type: 'string' },
             { name: 'lat', type: 'string'},
             { name: 'lgt', type: 'string'}
        ],
   }
})
Ext.define('myapp.store.SearchCapStore', {
    extend: 'Ext.data.Store',
    config: {
         model: 'myapp.model.SearchCapModel',
         autoLoad: true,
         proxy: {
             type: 'ajax',
             url : 'cerca-ristoranti-cap.json',
             reader: {
                   type: 'json',
                   rootProperty: 'restaurants'
             } //reader
         },
   }
});
Ext.define('myapp.controller.SearchCap', {
    extend : "Ext.app.Controller",

    views: ['SearchElenco'],

    config : {
         refs : {
             elencoListContainer: 'elencolistcontainer',
             btnSubmitLogin: 'button[action=searchCap]',
             form : 'appre-searchCap',
         },
         control : {
               btnSubmitLogin : {
                      tap : "onSubmitLogin"
               }
         }
    },
    onSubmitLogin : function() {
            console.log("onSubmitLogin");
            var values = this.getForm().getValues();
            console.log(values);

            Ext.Ajax.request({
                    url: 'cerca-ristoranti-cap.json',
                    method: 'POST',
                    params: {
                         values: Ext.encode({form_fields: values})
                    },
                    success: function(response, opts) {
                            var obj = response.responseText;
                            Ext.Msg.alert('Contact Complete!', obj);
                            Ext.Viewport.add(Ext.create('myapp.view.SearchElenco'));
                            Ext.Viewport.setActiveItem(1);
                    },
                    failure: function(response, opts) {
                          console.log('server-side failure with status code ' + response.status);
                    }
            });
    },
    resetForm: function() {
            this.getForm().reset();
    },
    launch : function() {
            this.callParent();
            console.log("LoginForm launch");
    },
    init : function() {
            this.callParent();
            console.log("LoginForm init");
    }
});
Ext.define('myapp.view.SearchElenco', {
    extend: 'Ext.Container',
    xtype: 'elencolistcontainer',

    requires: ['myapp.store.SearchCapStore'],

    initialize: function() {
            this.callParent(arguments);

            var s = Ext.create('myapp.store.SearchCapStore')
            var notesList = {
                    xtype: 'appre-elencoristoranti',
                    store: Ext.getStore(s).setAutoLoad(true),
                    listeners: {
                           disclose: {
                                    fn: this.onNotesListDisclose,
                                    scope: this
                           }
                    }
            };
            this.add([notesList])
    },
    onNotesListDisclose: function(list, record, target, index, event, options) {
            console.log('editNoteCommand');
            this.fireEvent('editNoteCommand', this, record);
    },

     config: {
           layout: {
                 type: 'fit'
           }
     }
});
Ext.define('myapp.view.ElencoRistoranti', {
    extend: 'Ext.dataview.List',
    xtype: 'appre-elencoristoranti',
    id: 'appreElenco',

    config: {
       emptyText: '<pre><div class="notes-list-empty-text">No list found.</div></pre>',
       onItemDisclosure: false,
       itemTpl: '<pre><div class="list-item-title">{id_restaurant}</div><div class="list-item-narrative">{name}</div></pre>',
    }
});


我希望能帮助你,如果你有男朋友,请告诉我。:)

请您展示一下cerca ristoranti cap.php的内容,我们可以为您提供帮助吗。Thxs.added响应cerca-ristoranti-cap.php,这是一个返回JSON的简单函数…请您将JSON文件放入。added。。。。这是最后一个密码!拜托,有人能帮我吗?非常感谢…非常感谢你的伟大工作!顺便问一下,我在哪里出错了?我看到你稍微改变了我的应用程序的“结构”(当然你的比我的好!)还有一件事,有可能给你“+1”、“一些明星”、一句“谢谢”之类的吗?下次谢谢你!好的,如果你认为回应是好的,接受并投票。谢谢:)。我不能投票,低于15的声誉:(顺便说一句,点击“有用的”。顺便说一句,你能解释一下,参考我的代码,我的错误在哪里吗?我没有关注它,遵循你的代码,它(自然)起作用。但是,如果我会使用我的代码呢?谢谢!