2011-01-28 18 views
0

我不熟悉sencha touch,所以如果有人能指出我会朝着正确的方向发展,那将会很棒。我的问题是我想显示来自我的数据库的数据。我似乎拥有了一切工作正常,当我检查我看到的数据元素,但我无法看到屏幕下面的数据是我的代码:无法在屏幕上看到数据,但我可以在元素中看到它

getUserList.js

Ext.regModel("User", { 
      fields: [ 
       "id", 
       "name", 
       "username", 
       "password", 
       "email", 
       "phone" 
      ] 
    }); 

    var myStore = new Ext.data.Store({ 
     model: 'User', 
     proxy: { 
      type: 'ajax', 
      url : '../sencha/php/getUserList.php', 
      reader: { 
       type: 'json', 
       root: 'results' 
      } 
     }, 
     autoLoad: true 
    }); 



    var tpl = new Ext.XTemplate(
     '<tpl for=".">', 
       '<div class="thumb-wrap" id="{id}">', 
       '<div class="thumb">title="{name}"></div>', 
       '<span class="x-editable">{name}</span></div>', 
      '<div style="background-color:#00F" class="thumb-wrap" id="{id}">{id}</div>', 
     '</tpl>', 
     '<div class="x-clear"></div>' 
    ); 

    var panel = new Ext.extend(Ext.Panel,{ 
     id:'images-view', 
     frame:true, 
     width:535, 
     autoHeight:true, 
     collapsible:true, 
     layout:'fit', 
     title:'Simple DataView', 
     initComponent: function() { 
      panel.superclass.initComponent.call(this); 
     }, 

     items: new Ext.DataView({ 
      store: myStore, 
      tpl: tpl, 
      autoHeight:true, 
      multiSelect: true, 
      overItemCls:'x-view-over', 
      itemSelector:'div.thumb-wrap', 
      emptyText: 'No images to display' 
     }) 
    }); 
    //panel.render(Ext.getBody()); 

     Ext.reg('userPanel', panel); 

的index.html

<!DOCTYPE html> 

用户

 <script type="text/javascript" src="sencha/sencha-touch.js"></script> 
    <script type="text/javascript" src="js/getUserList.js"></script> 

    <link href="sencha/resources/css/sencha-touch.css" rel="stylesheet" type="text/css" /> 



    <script type="text/javascript"> 
     var topPanel = { 
      style: 'padding:15px; background-color: #F00', 
      html: 'color2' 
     }; 

     new Ext.Application({ 
      launch: function() { 
       new Ext.Panel({ 
        fullscreen: true, 
        layout: { 
         type: 'hbox', 
         align: 'stretch' 
        }, 
        items:[{ 
          xtype: 'userPanel' 
          }], 
        dockedItems: [topPanel] 
       }); 
      } 
     });   

</script> 


</head> 
<body></body> 

感谢您提供任何帮助!

回答

0

我想通了,我不得不在我的index.html文件中添加一个布局到我的xtype

相关问题