2013-07-29 29 views
0

有没有其他人遇到过问题,ext js复选框没有显示出来?我们已经尝试了一切,甚至下载架构师软件,它仍然不会显示...任何想法?Ext JS 4 checkboxfield没有显示

我有一种感觉,就像我们错过了一个css/include文件,但我已经看遍了整个互联网,我仍然找不到解决方案。

{ 
      xtype: 'checkboxfield', 
      anchor: '100%', 
      fieldLabel: 'Label2', 
      boxLabel: 'Box Label2' 
     } 

这里的面板:

var manForm = Ext.create('Ext.form.Panel', { 
       width: 800, 
       style: 'position: relative; left: 20px;', 
       renderTo: Ext.getBody(), 
       id: 'man_form', 
       title: 'Mobile Information', 
       waitMsgTarget: true, 
       fieldDefaults: { 
        labelAlign: 'right', 
        labelWidth: 85, 
        msgTarget: 'side' 
       }, 
       items: [ 
         {      
          xtype: 'container', 
          padding: '10px', 
         defaults: { height: 28 }, 
          items: [{ 
              xtype: 'hiddenfield', 
              name: 'id', 
              id: 'id', 
            }, 
            { 
              xtype:'hiddenfield', 
              name: 'item_id', 
               id: 'item_id' 
            }, 
            { xtype: 'container', 
             layout: 'hbox', 
             defaults: { height: 28 }, 
             margin: ' 0 10 0 0', 
             items: [{ 
                 xtype:'textfield', 
                fieldLabel: 'Number', 
                 name: 'ItemNumber', 
                  id: 'ItemNumber', 
                labelWidth: 45, 
                 width: 345, 
                }, 
                { 
                 xtype:'textfield', 
                fieldLabel: 'Name', 
                 name: 'ItemName', 
                  id: 'ItemName', 
                labelWidth: 70, 
                 width: 425,             
               }] 
            }, 
            { 
              xtype: 'textfield', 
             fieldLabel: 'Category List', 
             labelWidth: 140, 
              width: 700, 
              name: 'CategoryList', 
               id: 'CategoryList' 
            }, 
            { 
              xtype: 'textfield', 
             fieldLabel: 'Short Desc For Cat List', 
              name: 'ShortDescriptionForCategoryList', 
               id: 'ShortDescriptionForCategoryList', 
             labelWidth: 140, 
              width: 600 
            }, 
            { xtype: 'container', 
             layout: 'hbox', 
             margin: ' 0 10 0 0', 
             items: [{ 
                 xtype: 'textfield',           
                 name: 'BasePrice', 
                fieldLabel: 'Base Price', 
                  id: 'BasePrice', 
                labelWidth: 140, 
                 width: 270, 
                 height: 28 
               }, 
               { 
                 xtype: 'textfield',           
                 name: 'RetailPrice', 
                fieldLabel: 'Retail Price', 
                  id: 'RetailPrice', 
                labelWidth: 140, 
                 width: 270, 
                 height: 28 
               },{ 
       xtype: 'checkboxfield', 
       anchor: '100%', 
       fieldLabel: 'Label2', 
       boxLabel: 'Box Label2' 
      } 


               ] 
            }, 
            { 
              xtype: 'textfield',           
              name: 'ItemImages', 
             fieldLabel: 'Item Images', 
               id: 'ItemImages', 
             labelWidth: 140, 
              width: 700             
            }, 
            { 
              xtype: 'textfield',           
              name: 'ItemPrimaryImageUrl', 
             fieldLabel: 'Primary Image URL', 
               id: 'ItemPrimaryImageUrl', 
             labelWidth: 140, 
              width: 700             
            },          
            { 
              xtype: 'textfield',           
              name: 'ItemPrimaryImageAltText', 
             fieldLabel: 'Primary Image Alt Text', 
               id: 'ItemPrimaryImageAltText', 
             labelWidth: 140, 
              width: 700             
            }, 
            { 
              xtype: 'textfield',           
              name: 'ItemThumbnailUrl', 
             fieldLabel: 'Thumbnail URL', 
               id: 'ItemThumbnailUrl', 
             labelWidth: 140, 
              width: 700             
            }, 
            { 
              xtype: 'textfield',           
              name: 'ItemThumbnailAltText', 
             fieldLabel: 'Thumbnail Alt Text', 
               id: 'ItemThumbnailAltText', 
             labelWidth: 140, 
              width: 700             
            },           
            { 
              xtype: 'button', 
              text: 'Update', 
              name: 'new_button', 
               id: 'new_button', 
              style: 'margin-left:720px; margin-bottom:5px', 
             handler: function(event, toolEl, panel){ 

               Ext.Msg.show({ 
                title:'Update Data', 
                msg: 'Are you sure you want to update these settings?', 
                buttons: Ext.Msg.YESNO, 
                icon: Ext.Msg.QUESTION, 
                fn: function(btn){ 
                if (btn === 'yes'){ 

                 var obj = manForm.getForm().getValues(); 
                 for (var prop in obj) { 
                 store.getAt(0).set(prop,obj[prop]);     
                 //alert(prop + " : " + obj[prop]); 
                 } 

                 store.update(); 
                 store.load(); 
                } 
                } 
               }); 
             } 
            }, 
         ] 

        }], 
     }); 
+2

我插入你的代码,并能看到复选框就好了。它可能是一些自定义的CSS获取方式。你是否检查过包含复选框的'hbox'以查看计算出的CSS的样子? – kevhender

+0

嗨,kev,谢谢你的帮助。我评论了hbox布局参考,它仍然没有出现......任何其他想法? – user1801932

+0

kevhender,就是这样......我评论了css文件,并显示了复选框。非常感谢你的帮助! – user1801932

回答

0

我没有真正考验你的代码像kevhender一样。但事实上,它适用于他,但不适合你,这让我觉得你没有extjs用于复选框的图像文件。通常它被放置在images/form/checkbox.gif中。 请检查您的图像文件夹一次。另外开发工具(Firebug或Chrome开发工具)控制台应该抛出一个错误,如果是这种情况 - 说“文件不能在路径blahblah”或什么的。

+0

有趣。我将检查图像文件和css ...我以前从未使用过hbox,所以我可能会对此有疑问。谢谢。 – user1801932

+0

好的,我检查了checkbox.gif,它在那里... Firebug或Chrome开发工具没有错误 – user1801932