2013-03-06 93 views
0
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

回答

0
如下

更改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(); 
} 

未經測試,但它應該與可能的調整工作。

0

試試這個:

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 
    ] 
    }); 
}