博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
从零开始学习Sencha Touch MVC应用之十八
阅读量:6863 次
发布时间:2019-06-26

本文共 1065 字,大约阅读时间需要 3 分钟。

建立一个新的控制器以处理新闻(NewsController.js):
Ext.regController('News', {      // index action    index: function(options)    {        if ( ! this.indexView)        {            this.indexView = this.render({                xtype: 'NewsIndex',            });        }          var backBtn = this.application.viewport.query('#backBtn')[0];        backBtn.show();          backBtn.setHandler(function()        {            Ext.dispatch({                controller: 'Home',                action: 'index',                historyUrl: 'Home/index',                //                animation: {                    type: 'slide',                    reverse: true,                },            });        });          this.application.viewport.setActiveItem(this.indexView, options.animation);    },});
现在新闻控制其索引视图为(NewsIndexView.js):
App.views.NewsIndex = Ext.extend(Ext.List, {    store: 'NewsItems',    itemTpl: '{title}, {date}',});Ext.reg('NewsIndex', App.views.NewsIndex);
正像我们前面所见,我们已经采用了 Ext.List 组件来显示新闻.

转载于:https://www.cnblogs.com/fyq891014/archive/2012/05/08/4188890.html

你可能感兴趣的文章