2011-08-29 42 views
0

我運行此代碼,下拉不會下拉 - 沒有項目顯示。ExtJS組合框將不會顯示項目

尋找調試器我看到商店沒有物品。

當我註釋掉'url'並取消註釋'data'(其中包含由.cfm頁面生成的確切json字符串)時,下拉按預期工作。

任何人都知道這裏發生了什麼?

<html> 
<head> 
    <link rel="stylesheet" type="text/css" href="ext-3.1.0/resources/css/ext-all.css" /> 
    <script src="ext-3.1.0/adapter/ext/ext-base.js"></script> 
    <script src="ext-3.1.0/ext-all-debug.js"></script> 
    <script> 
     if (Ext.BLANK_IMAGE_URL.substr(0,5) != 'data:') 
     { 
     Ext.BLANK_IMAGE_URL = 'ext-3.1.0/resources/images/default/s.gif'; 
     } 
     Ext.onReady(function() 
     { 
     var testStore = new Ext.data.JsonStore({ 
      url: 'combotest.cfm', 
      //data: {"ROWS":[{"NAME":"one"},{"NAME":"two"},{"NAME":"three"}]}, 
      root: 'ROWS', 
      fields: ['NAME'], 
      autoLoad: true 
     }); 

     var test_form = new Ext.FormPanel(
     { 
      renderTo: Ext.getBody(), 
      frame: true, 
      title: 'Form', 
      width: 500, 
      items: [ 
      { 
       xtype: 'combo', 
       fieldLabel: 'Combo Box', 
       triggerAction: 'all', 
       mode: 'local', 
       store: testStore, 
       displayField: 'NAME', 
       width: 350 
      } 
      ] 
     }); 
     }); 
    </script> 
</head> 
<body> 
</body> 
</html> 
+0

一位同事弄明白了。 除了json字符串,.cfm頁面還在返回調試信息。 添加 清除它。 – user526747

+0

添加您的解決方案作爲答案,然後將其標記爲接受的答案 – JamesHalsall

回答

1

一位同事弄明白了。除了json字符串,.cfm頁面還返回調試信息。添加

<cfsetting showdebugoutput="FALSE"> 

到.cfm頁面的結尾清除它。