how to display list and other labels in single page using sencha touch2

放肆的年华 提交于 2019-12-11 12:00:11

问题


I am new to sencha touch2. i want to display some text labels below in that want display list. so i have define some labels and accessing twitter service it will give list of data. below is my code.

  1. in this code if I comment the extend: 'Ext.form.Panel', if i used extend: 'Ext.navigation.View' then list data will display but wont display defined labels.
  2. if I comment the extend: 'Ext.navigation.View', if i used extend: 'Ext.form.Panel' then list data wont display but it will display defined labels.

please tell me what is the problem in my code:

Code:

Ext.define("E:\SenchaTouch.view.Main", {
  extend: 'Ext.form.Panel',
  //extend: 'Ext.navigation.View',
  xtype: 'companyprofilepage',
  id: 'companyprofile',
  config: { 
    items: [
    { 
      xtype: 'toolbar',
      docked: 'top',
      title: 'My Toolbar'
    },
    { 
      xtype: 'titlebar',
      title: 'Title name'
    },
    {
      margin: '10',
      xtype: 'label',
      html: 'Info1'
    },
    { 
      margin: '10',
      xtype: 'label',
      html: 'A company is a business organization. It is an association or collection of individual real '
    }, 
    {
      xtype: 'list',
      itemTpl: '{title}', 
      store: {
        autoLoad: true,
        fields: ['from_user', 'text', 'profile_image_url'],
        proxy: {
          type: 'jsonp',
          url: 'http://search.twitter.com/search.json?q=Sencha Touch',
          reader: {
            type: 'json',
            root: 'results'
          }
        }
      },
      itemTpl: '<img src="{profile_image_url}" /><h2>{from_user}</h2><p>{text}</p>'
    }] 
  }
});

回答1:


only create Ext.Panel({}) and into these Panel can you put others Sencha elements. I hope help you. :)




回答2:


The reason is navigationview and panel are set this config: layout: 'card' by default.

To have all your components display on single page, extend Ext.Container and add layout: 'vbox' to its config.

Hope it helps.



来源:https://stackoverflow.com/questions/10611855/how-to-display-list-and-other-labels-in-single-page-using-sencha-touch2

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