2011-05-02 71 views
2

那麼,如何創建多選?extJS如何創建多選?

我在sencha.com發現這個教程:

 var msForm = new Ext.form.FormPanel({ 
    title: 'MultiSelect Test', 
    width:700, 
    bodyStyle: 'padding:10px;', 
    items:[{ 
     xtype:"multiselect", 
     fieldLabel:"Multiselect<br />(Required)", 
     name:"multiselect", 
     dataFields:["code", "desc"], 
     valueField:"code", 
     displayField:"desc", 
     width:250, 
     height:200, 
     allowBlank:false, 
     data:[[123,"One Hundred Twenty Three"], 
      ["1", "One"], ["2", "Two"], ["3", "Three"], ["4", "Four"], ["5", "Five"], 
      ["6", "Six"], ["7", "Seven"], ["8", "Eight"], ["9", "Nine"]], 
     tbar:[{ 
      text:"clear", 
      handler:function(){ 
       msForm.getForm().findField("multiselect").reset(); 
      } 
     }] 
    }],  
    buttons: [{ 
     text: 'Save', 
     handler: function(){ 
      if(msForm.getForm().isValid()){ 
       Ext.Msg.alert('Submitted Values', 'The following will be sent to the server: <br />'+ 
        msForm.getForm().getValues(true)); 
      } 
     } 
    }] 
}); 
當我貼吧,寫msForm

,只是白色的屏幕,當我刪除此代碼,萬物完美..跆拳道?我也想多選!

+0

下載Firefox,來自getfirebug.com安裝Firebug擴展,然後用Firebug的運行代碼,打開和報到錯誤信息。 – JamesHalsall 2011-05-02 11:20:09

+0

沒有錯誤螢火蟲建立 – waucherererpo 2011-05-02 11:27:01

+1

如果正在顯示_nothing_,則必須發生錯誤,如果頁面上有文本,那麼它可能只是一個CSS問題 – JamesHalsall 2011-05-02 11:59:24

回答

1

只需添加代碼是不夠的!您需要添加CSS和JS文件。您需要添加:

  1. MultiSelect.css
  2. MultiSelect.js

您還必須使用ItemSelector.js按您的要求。這些文件可在:

  1. http://dev.sencha.com/deploy/ext-3.3.0/examples/ux/css/MultiSelect.css
  2. http://dev.sencha.com/deploy/ext-3.3.0/examples/ux/MultiSelect.js
  3. http://dev.sencha.com/deploy/ext-3.3.0/examples/ux/ItemSelector.js
+0

它支持extjs版本3.0嗎? – waucherererpo 2011-05-02 11:25:06

+0

是應該.. – 2011-05-02 11:26:17

+0

嗯,仍然沒有什麼,奇怪的問題我有:S – waucherererpo 2011-05-02 11:27:33