zoukankan      html  css  js  c++  java
  • 从零开始学习Sencha Touch MVC应用之十八

    建立一个新的控制器以处理新闻(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}, <span class="date">{date}</date>',
    });
    Ext.reg('NewsIndex', App.views.NewsIndex);


    正像我们前面所见,我们已经采用了 Ext.List 组件来显示新闻.
  • 相关阅读:
    还得还得学啊
    感觉自己写的东西很死板啊
    好烦啊,不知道选哪个?
    222
    111
    愁人啊
    ssm+ajax实现登陆
    ssm框架搭建
    抽象类与接口
    代理设计模式
  • 原文地址:https://www.cnblogs.com/fyq891014/p/4188890.html
Copyright © 2011-2022 走看看