On Button点击显示清单...在sencha

问题描述:

Ext.application({ 
    launch: function() { 

    Ext.define("User", { 
     extend: "Ext.data.Model", 
     config: { 
     fields: [{name: "title", type: "string"}] 
     } 
    }); 

    var myStore = Ext.create("Ext.data.Store", { 
     model: "User", 
     proxy: { 
     type: "ajax", 
     url : "http://www.imdb.com/xml/find?json=1&nr=1&tt=on&q=twilight", 
     reader: { 
      type: "json", 
      rootProperty: "title_popular" 
     } 
     }, 
     autoLoad: true 
    }); 

    var view = Ext.Viewport.add({ 
     xtype: 'navigationview', 
     //we only give it one item by default, which will be the only item in the 'stack' when it loads 
     items: [{ 
     xtype:'formpanel', 
     title: 'SEARCH IMDB MOVIES ', 
     padding: 10, 
     items: [{ 
      xtype: 'fieldset', 
      title: 'Search Movies from IMDB', 
      items: [{ 
      xtype: 'textfield', 
      name : 'Movie Search', 
      label: 'Search Movie' 
      }, { 
      xtype: 'button', 
      text: 'Submit', 
      handler: function() { 
       view.push({ 
       //this one also has a title 
       title: 'List of Movies', 
       padding: 10, 
       //once again, this view has one button 
       items: [{ 
        xyz.show(); 
       }] 
       }); 
      } 
      }] 
     }] 
     }] 
    }); 

    var xyz = new Ext.create("Ext.List", { 
     fullscreen: true, 
     store: myStore, 
     itemTpl: "{title}" 
    }); 
    } 
}); 

错误是与xyz.show(); 它会正常工作,如果我删除xyz.show(); 但我想点击按钮移到
这之后,显示列表上的按钮,点击导航视图我想显示列表On Button点击显示清单...在sencha

+0

你在'var view = ...'之前用'var xyz = ...'试过了吗? – 2013-03-06 07:36:54

+0

是的....但它也没有工作..我也想知道如何getvalue我们设置的文本框,然后点击提交按钮 – alpha 2013-03-06 11:32:16

如下

更改XYZ名单:

var xyz = new Ext.create("Ext.List", { 
    //this one also has a title 
    title: 'List of Movies', 
    padding: 10, 
    xtype:'xyz', 
    alias:'xyz', 
    hidden:true, 
    fullscreen: true, 
    store: myStore, 
    itemTpl: "{title}" 
}); 

然后它下面写

view.add(xyz); 

然后在你的处理器

handler: function() { 
    xyz.show(); 
} 

未经测试,但它应该与可能的调整工作。

试试这个:

handler: function() { 
    view.push({ 
    //this one also has a title 
    title: 'List of Movies', 
    padding: 10, 
    //once again, this view has one button 
    items: [ 
     xyz 
    ] 
    }); 
}