2017-10-05 16 views
0

これはエラーを表示していないし、UIを表示していません。私は、数値フィールドを動的に追加したい。煎茶タッチで私はext jsに非常に新しいです、誰でも自分のコードで何が間違っているのかを教えてください

var numberField= Ext.create('Ext.form.Panel', { 
      cls: 'questionRows', 
      hidden: show, 
      itemId: item.HealthNeedsDetailsGuid, 
      id: item.HealthNeedsDetailsGuid, 
      items: [{ 
       xtype: 'field', 
       html: item_index + ') ' + item.HealthNeedsQuestion 
      }, { 
       xtype: 'numberfield', 
       anchor: '100%', 
       name: 'bottles', 
       clearIcon: false, 
       width: 400, 
       value: 99, 
       maxValue: 99, 
       minValue: 0 
      }] 
     }); 
+0

::このような「ショー」が変数の場合ショー、それは「偽」である必要があります。 idsを使うべきではなく、itemIdsだけを使うべきです。あなたが数字フィールド(おそらくlabelAlign: 'top')でラベルを使うことができるので、xtype 'field'の項目は必要ありません – Dinkheller

答えて

1

Ext.form.Panelスクロールアイテムですので、あなたが、高さを指定するかnullとしてscrollable財産を作るそれまでは表示されません。

fullscreen:trueのプロパティをExt.form.Panelに入力すると、画面全体に番号フィールドを表示することができます。

Ext.application({ 
 
    launch : function() { 
 
     var numberField= Ext.create('Ext.form.Panel', { 
 
     cls: 'questionRows', 
 
     fullscreen:true, 
 
     items: [{ 
 
      xtype: 'field', 
 
      html: 'Field Html here' 
 
     }, { 
 
      xtype: 'numberfield', 
 
      anchor: '100%', 
 
      name: 'bottles', 
 
      clearIcon: false, 
 
      width: 400, 
 
      value: 99, 
 
      maxValue: 99, 
 
      minValue: 0 
 
     }] 
 
    }); 
 
    } 
 
});
<link rel="stylesheet" href="https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css"> 
 
<script type="text/javascript" src="https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all-debug.js"></script>

OR

既存のコンポーネントから既存のコンポーネント呼び出しadd()に追加し、そのパラメータmainPanel.add(numberField);としてnumberFieldを与えるために:このように。 numberFieldにはheightプロパティまたはscrollable:nullプロパティがExt.form.Panelに与えられます。隠された

Ext.application({ 
 
    launch : function() { 
 
     var numberField= Ext.create('Ext.form.Panel', { 
 
     cls: 'questionRows', 
 
     height:344, 
 
     items: [{ 
 
      xtype: 'field', 
 
      html: 'Field Html here' 
 
     }, { 
 
      xtype: 'numberfield', 
 
      anchor: '100%', 
 
      name: 'bottles', 
 
      clearIcon: false, 
 
      width: 400, 
 
      value: 99, 
 
      maxValue: 99, 
 
      minValue: 0 
 
     }] 
 
    }); 
 
//this is the Panel we'll be adding to 
 
var mainPanel = Ext.create('Ext.Panel', { 
 
fullscreen: true, 
 
items: { 
 
    html: 'Main Panel' 
 
} 
 
}); 
 
//now we add the numberField inside the main panel 
 
mainPanel.add(numberField); 
 
    } 
 
});
<link rel="stylesheet" href="https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css"> 
 
<script type="text/javascript" src="https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all-debug.js"> 
 
</script>

+0

助けてくれてありがとう、私はそれをしましたが、まだ何もしていません。 –

+0

あなたはどのバージョンを使用していますか?問題を理解するためにもっとコードが必要です。 –

+0

私はいくつかの古いコードに取り組んでいます、バージョンは2.4.2です、それは大丈夫です。 –

関連する問題