2013-08-28 40 views
0

在这里我的代码使用sencha显示列表。当我点击任何任何行如何使可见详细view.I已尝试以下链接Sencha nested list的方式,但没有回应。嵌套列表视图显示其他

列表视图

var tab= Ext.create('Ext.List', { 
           width: 320, 
           height: 320, 
           store: { 
           fields: ['ext_xtype','imgURL','arimg'], 
           data: [{ 
             ext_xtype: 'Harry Potter 4', 
             imgURL:'bo.png', 
             arimg:'arrow.png' 
             },{ 
             ext_xtype: 'Iphone5 64gb', 
             imgURL:'mo.png', 
             arimg:'arrow.png' 
             },{ 
             ext_xtype: 'Hill Figure', 
             imgURL:'wa.png', 
             arimg:'arrow.png' 
             }] 
           }, 
           itemTpl: '<img src="{imgURL}" width="35" heigh="35"></img><span>&nbsp&nbsp&nbsp{ext_xtype}<img src="{arimg}" width="25" height="25" align="right"></img>' 
           }); 

详细视图

var sprfolievu = { 
      standardSubmit : false, 
      items: [{ 
        xtype: 'fieldset', 
        title: '', 
        items: [ 
          { 
          xtype: 'container', 
          layout: 'vbox', 
          title: '', 
          items: [{ 
            xtype: 'container', 
            items: [{ 
              xtype: 'container', 
              margin: 10, 
              layout: 'hbox', 
              items: [logo,{ 
                xtype: 'label', 
                html: '&nbsp&nbsp&nbsp' 

                } 

                ] 
              },] 
            },tablevuu ] 
          } 
          ] 
        }] 
      } 

请告诉我问题,我的代码吗?请帮我梳理出来

+0

sprfolievu不太好看。你想用它做什么? – Viswa

+0

@Viswa当点击列表中的任何一行时,我想显示sprfolievu – ioseve

+0

你知道了吗? – Viswa

回答

0

你不遵循MVC,所以代码总是看起来很丑。

了解listenersevents

我已经做了一些修改sprfolievuand并添加后退按钮。

var sprfolievu = { 
      standardSubmit : false, 
      items: [{ 
       xtype : 'toolbar', 
       items : [{ 
        ui : 'back', 
        text : 'back', 
        handler : function(){ 
        Ext.Viewport.setActiveItem(list); 
        } 
       }], 
       },{ 
        xtype: 'fieldset', 
        title: '', 
        items: [{ 
          xtype: 'container', 
          layout: 'vbox', 
          title: '', 
          items: [{ 
            xtype: 'container', 
            items: [{ 
              xtype: 'container', 
              margin: 10, 
              layout: 'hbox', 
              items: [{ 
                xtype: 'label', 
                html: '&nbsp&nbsp&nbsp' 
                }] 
              }] 
            }] 
          }] 
        }] 
      }; 

在列表中还做了一些更改。

var list = Ext.create('Ext.List', { 
     store: { 
      fields: ['ext_xtype','imgURL','arimg'], 
      data: [{ 
       ext_xtype: 'Harry Potter 4', 
       imgURL:'bo.png', 
       arimg:'arrow.png' 
      },{ 
       ext_xtype: 'Iphone5 64gb', 
       imgURL:'mo.png', 
       arimg:'arrow.png' 
      },{ 
       ext_xtype: 'Hill Figure', 
       imgURL:'wa.png', 
       arimg:'arrow.png' 
      }] 
     }, 
     itemTpl: ['<img src="{imgURL}" width="25" heigh="25">'+ 
       '</img><span>{ext_xtype}</span>'+ 
       '<img src="{arimg}" width="25" height="25" align="right"></img>'].join(), 
     listeners : { 
      itemtap: function(list, index, target, record, e, eOpts) { 
       Ext.Viewport.setActiveItem(sprfolievu); 
      } 
     } 

    }); 

    Ext.Viewport.add(list); 
    Ext.Viewport.add(sprfolievu); 
+0

它不能正常工作..这里的代码pastebin.com/nyqa8Uur – ioseve