开发者

ExtJS ComboBox won't display items

开发者 https://www.devze.com 2023-04-01 01:36 出处:网络
I run this code and the dropdown won\'t drop down -- no items get displayed. Looking in the debugger I see that the store has no items.

I run this code and the dropdown won't drop down -- no items get displayed.

Looking in the debugger I see that the store has no items.

When I comment out the 'url' and uncomment 'data' (which contains the exact json string produced by the .cfm page) the dropdown works as expected.

Anyone know what's going on here?

<html>
<head>
   <link rel="stylesheet" type="开发者_JAVA百科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>


A colleague figured it out. The .cfm page was returning debug info in addition to the json string. Adding

<cfsetting showdebugoutput="FALSE">  

to the end of the .cfm page cleared it up.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号