Add input field in Ext.tab.Panel












1















I am creating a menu using Ext.tab.Panel and would like to have Search feature. Something like Bootstrap navbar - https://getbootstrap.com/docs/4.0/components/navbar/



I tried to simply add the textfield element but didn't work obviously.



Ext.create('Ext.TabPanel', {
fullscreen: true,

items: [{
title: 'Home',
iconCls: 'home',
html: 'Home Screen'
},
{
title: 'Contact',
iconCls: 'user',
html: 'Contact Screen'
},
{
xtype: 'textfield',
name: 'name',
fieldLabel: 'Name',
allowBlank: false // requires a non-empty value
}
]
});


Is it possible to achieve this at all?










share|improve this question























  • It works: fiddle.sencha.com/#view/editor&fiddle/2nls

    – beso9595
    Nov 13 '18 at 16:58
















1















I am creating a menu using Ext.tab.Panel and would like to have Search feature. Something like Bootstrap navbar - https://getbootstrap.com/docs/4.0/components/navbar/



I tried to simply add the textfield element but didn't work obviously.



Ext.create('Ext.TabPanel', {
fullscreen: true,

items: [{
title: 'Home',
iconCls: 'home',
html: 'Home Screen'
},
{
title: 'Contact',
iconCls: 'user',
html: 'Contact Screen'
},
{
xtype: 'textfield',
name: 'name',
fieldLabel: 'Name',
allowBlank: false // requires a non-empty value
}
]
});


Is it possible to achieve this at all?










share|improve this question























  • It works: fiddle.sencha.com/#view/editor&fiddle/2nls

    – beso9595
    Nov 13 '18 at 16:58














1












1








1








I am creating a menu using Ext.tab.Panel and would like to have Search feature. Something like Bootstrap navbar - https://getbootstrap.com/docs/4.0/components/navbar/



I tried to simply add the textfield element but didn't work obviously.



Ext.create('Ext.TabPanel', {
fullscreen: true,

items: [{
title: 'Home',
iconCls: 'home',
html: 'Home Screen'
},
{
title: 'Contact',
iconCls: 'user',
html: 'Contact Screen'
},
{
xtype: 'textfield',
name: 'name',
fieldLabel: 'Name',
allowBlank: false // requires a non-empty value
}
]
});


Is it possible to achieve this at all?










share|improve this question














I am creating a menu using Ext.tab.Panel and would like to have Search feature. Something like Bootstrap navbar - https://getbootstrap.com/docs/4.0/components/navbar/



I tried to simply add the textfield element but didn't work obviously.



Ext.create('Ext.TabPanel', {
fullscreen: true,

items: [{
title: 'Home',
iconCls: 'home',
html: 'Home Screen'
},
{
title: 'Contact',
iconCls: 'user',
html: 'Contact Screen'
},
{
xtype: 'textfield',
name: 'name',
fieldLabel: 'Name',
allowBlank: false // requires a non-empty value
}
]
});


Is it possible to achieve this at all?







extjs






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 '18 at 15:52









harunB10harunB10

62611126




62611126













  • It works: fiddle.sencha.com/#view/editor&fiddle/2nls

    – beso9595
    Nov 13 '18 at 16:58



















  • It works: fiddle.sencha.com/#view/editor&fiddle/2nls

    – beso9595
    Nov 13 '18 at 16:58

















It works: fiddle.sencha.com/#view/editor&fiddle/2nls

– beso9595
Nov 13 '18 at 16:58





It works: fiddle.sencha.com/#view/editor&fiddle/2nls

– beso9595
Nov 13 '18 at 16:58












2 Answers
2






active

oldest

votes


















1














You can archive it with the tabbar config of the Ext.tab.Panel.
The Ext.tab.Bar is a specialized Ext.container.Container where you can add items like a to Textfield.



So add te search textfield to the tabbar config and you can archive what you want to, see the example code below and the Sencha Fiddle.



Ext.create('Ext.TabPanel', {
fullscreen: true,

items: [{
title: 'Home',
iconCls: 'home',
html: 'Home Screen'
},
{
title: 'Contact',
iconCls: 'user',
html: 'Contact Screen'
},
],
tabBar: {
items: [
{
xtype: 'textfield',
name: 'name',
fieldLabel: 'Name',
allowBlank: false // requires a non-empty value
}
]
},
renderTo: Ext.getBody()
});





share|improve this answer































    0














    At first this functionality does not exist in the tabpanel, which I recommend you do and replace the idea of ​​tabpanel to apply a cardlayout which is the same tabpanel layout system.



    And then you can use a toolbar, with the buttons being configured with the toogleGroup, in short, you'd better see the code example below working.



    Ext.application({
    name: 'Fiddle',
    launch: function () {
    Ext.create('Ext.Panel', {
    fullscreen: true,
    renderTo: Ext.getBody(),
    layout: {
    type: 'vbox',
    align: 'stretch'
    },
    items: [{
    xtype: 'toolbar',
    height: 42,
    defaults: {
    xtype: 'button',
    },
    items: [{
    text: 'Tab1',
    handler: function(button){
    var me = this,
    fakeContainer = button.up('panel').down('#fakeTab');
    fakeContainer.setActiveItem(button.tabIndex);
    },
    tabIndex: 0,
    toggleGroup: 'tabHandler',
    enableToggle: true,
    pressed: true,
    margin: '0'
    }, {
    text: 'Tab2',
    handler: function(button){
    var me = this,
    fakeContainer = button.up('panel').down('#fakeTab');
    fakeContainer.setActiveItem(button.tabIndex);
    },
    tabIndex: 1,
    enableToggle: true,
    margin: '0'
    }, {
    text: 'Tab3',
    handler: function(button){
    var me = this,
    fakeContainer = button.up('panel').down('#fakeTab');
    fakeContainer.setActiveItem(button.tabIndex);
    },
    tabIndex: 2,
    toggleGroup: 'tabHandler',
    enableToggle: true,
    margin: '0'
    }, '->', {
    xtype: 'textfield',
    fieldLabel: 'Search:',
    labelWidth: 70,
    width: 250,
    margin: 0
    }, {
    iconCls: 'x-fa fa-search',
    handler: function(){
    alert('Your Search here!');
    }
    }]
    }, {
    xtype: 'container',
    itemId: 'fakeTab',
    margin: '16 0 0 0',
    flex: 1,
    layout: 'card',
    defaults: {
    xtype: 'container',
    height: 800
    },
    items: [{
    html: '<STRONG>TAB 1 your content here</STRONG>'
    }, {
    html: '<STRONG>TAB 2 your content here</STRONG>'
    }, {
    html: '<STRONG>TAB 3 your content here</STRONG>'
    }]
    }]
    });
    }
    });


    Working sample here






    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53284731%2fadd-input-field-in-ext-tab-panel%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      You can archive it with the tabbar config of the Ext.tab.Panel.
      The Ext.tab.Bar is a specialized Ext.container.Container where you can add items like a to Textfield.



      So add te search textfield to the tabbar config and you can archive what you want to, see the example code below and the Sencha Fiddle.



      Ext.create('Ext.TabPanel', {
      fullscreen: true,

      items: [{
      title: 'Home',
      iconCls: 'home',
      html: 'Home Screen'
      },
      {
      title: 'Contact',
      iconCls: 'user',
      html: 'Contact Screen'
      },
      ],
      tabBar: {
      items: [
      {
      xtype: 'textfield',
      name: 'name',
      fieldLabel: 'Name',
      allowBlank: false // requires a non-empty value
      }
      ]
      },
      renderTo: Ext.getBody()
      });





      share|improve this answer




























        1














        You can archive it with the tabbar config of the Ext.tab.Panel.
        The Ext.tab.Bar is a specialized Ext.container.Container where you can add items like a to Textfield.



        So add te search textfield to the tabbar config and you can archive what you want to, see the example code below and the Sencha Fiddle.



        Ext.create('Ext.TabPanel', {
        fullscreen: true,

        items: [{
        title: 'Home',
        iconCls: 'home',
        html: 'Home Screen'
        },
        {
        title: 'Contact',
        iconCls: 'user',
        html: 'Contact Screen'
        },
        ],
        tabBar: {
        items: [
        {
        xtype: 'textfield',
        name: 'name',
        fieldLabel: 'Name',
        allowBlank: false // requires a non-empty value
        }
        ]
        },
        renderTo: Ext.getBody()
        });





        share|improve this answer


























          1












          1








          1







          You can archive it with the tabbar config of the Ext.tab.Panel.
          The Ext.tab.Bar is a specialized Ext.container.Container where you can add items like a to Textfield.



          So add te search textfield to the tabbar config and you can archive what you want to, see the example code below and the Sencha Fiddle.



          Ext.create('Ext.TabPanel', {
          fullscreen: true,

          items: [{
          title: 'Home',
          iconCls: 'home',
          html: 'Home Screen'
          },
          {
          title: 'Contact',
          iconCls: 'user',
          html: 'Contact Screen'
          },
          ],
          tabBar: {
          items: [
          {
          xtype: 'textfield',
          name: 'name',
          fieldLabel: 'Name',
          allowBlank: false // requires a non-empty value
          }
          ]
          },
          renderTo: Ext.getBody()
          });





          share|improve this answer













          You can archive it with the tabbar config of the Ext.tab.Panel.
          The Ext.tab.Bar is a specialized Ext.container.Container where you can add items like a to Textfield.



          So add te search textfield to the tabbar config and you can archive what you want to, see the example code below and the Sencha Fiddle.



          Ext.create('Ext.TabPanel', {
          fullscreen: true,

          items: [{
          title: 'Home',
          iconCls: 'home',
          html: 'Home Screen'
          },
          {
          title: 'Contact',
          iconCls: 'user',
          html: 'Contact Screen'
          },
          ],
          tabBar: {
          items: [
          {
          xtype: 'textfield',
          name: 'name',
          fieldLabel: 'Name',
          allowBlank: false // requires a non-empty value
          }
          ]
          },
          renderTo: Ext.getBody()
          });






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 14 '18 at 7:35









          And-yAnd-y

          1,33821829




          1,33821829

























              0














              At first this functionality does not exist in the tabpanel, which I recommend you do and replace the idea of ​​tabpanel to apply a cardlayout which is the same tabpanel layout system.



              And then you can use a toolbar, with the buttons being configured with the toogleGroup, in short, you'd better see the code example below working.



              Ext.application({
              name: 'Fiddle',
              launch: function () {
              Ext.create('Ext.Panel', {
              fullscreen: true,
              renderTo: Ext.getBody(),
              layout: {
              type: 'vbox',
              align: 'stretch'
              },
              items: [{
              xtype: 'toolbar',
              height: 42,
              defaults: {
              xtype: 'button',
              },
              items: [{
              text: 'Tab1',
              handler: function(button){
              var me = this,
              fakeContainer = button.up('panel').down('#fakeTab');
              fakeContainer.setActiveItem(button.tabIndex);
              },
              tabIndex: 0,
              toggleGroup: 'tabHandler',
              enableToggle: true,
              pressed: true,
              margin: '0'
              }, {
              text: 'Tab2',
              handler: function(button){
              var me = this,
              fakeContainer = button.up('panel').down('#fakeTab');
              fakeContainer.setActiveItem(button.tabIndex);
              },
              tabIndex: 1,
              enableToggle: true,
              margin: '0'
              }, {
              text: 'Tab3',
              handler: function(button){
              var me = this,
              fakeContainer = button.up('panel').down('#fakeTab');
              fakeContainer.setActiveItem(button.tabIndex);
              },
              tabIndex: 2,
              toggleGroup: 'tabHandler',
              enableToggle: true,
              margin: '0'
              }, '->', {
              xtype: 'textfield',
              fieldLabel: 'Search:',
              labelWidth: 70,
              width: 250,
              margin: 0
              }, {
              iconCls: 'x-fa fa-search',
              handler: function(){
              alert('Your Search here!');
              }
              }]
              }, {
              xtype: 'container',
              itemId: 'fakeTab',
              margin: '16 0 0 0',
              flex: 1,
              layout: 'card',
              defaults: {
              xtype: 'container',
              height: 800
              },
              items: [{
              html: '<STRONG>TAB 1 your content here</STRONG>'
              }, {
              html: '<STRONG>TAB 2 your content here</STRONG>'
              }, {
              html: '<STRONG>TAB 3 your content here</STRONG>'
              }]
              }]
              });
              }
              });


              Working sample here






              share|improve this answer




























                0














                At first this functionality does not exist in the tabpanel, which I recommend you do and replace the idea of ​​tabpanel to apply a cardlayout which is the same tabpanel layout system.



                And then you can use a toolbar, with the buttons being configured with the toogleGroup, in short, you'd better see the code example below working.



                Ext.application({
                name: 'Fiddle',
                launch: function () {
                Ext.create('Ext.Panel', {
                fullscreen: true,
                renderTo: Ext.getBody(),
                layout: {
                type: 'vbox',
                align: 'stretch'
                },
                items: [{
                xtype: 'toolbar',
                height: 42,
                defaults: {
                xtype: 'button',
                },
                items: [{
                text: 'Tab1',
                handler: function(button){
                var me = this,
                fakeContainer = button.up('panel').down('#fakeTab');
                fakeContainer.setActiveItem(button.tabIndex);
                },
                tabIndex: 0,
                toggleGroup: 'tabHandler',
                enableToggle: true,
                pressed: true,
                margin: '0'
                }, {
                text: 'Tab2',
                handler: function(button){
                var me = this,
                fakeContainer = button.up('panel').down('#fakeTab');
                fakeContainer.setActiveItem(button.tabIndex);
                },
                tabIndex: 1,
                enableToggle: true,
                margin: '0'
                }, {
                text: 'Tab3',
                handler: function(button){
                var me = this,
                fakeContainer = button.up('panel').down('#fakeTab');
                fakeContainer.setActiveItem(button.tabIndex);
                },
                tabIndex: 2,
                toggleGroup: 'tabHandler',
                enableToggle: true,
                margin: '0'
                }, '->', {
                xtype: 'textfield',
                fieldLabel: 'Search:',
                labelWidth: 70,
                width: 250,
                margin: 0
                }, {
                iconCls: 'x-fa fa-search',
                handler: function(){
                alert('Your Search here!');
                }
                }]
                }, {
                xtype: 'container',
                itemId: 'fakeTab',
                margin: '16 0 0 0',
                flex: 1,
                layout: 'card',
                defaults: {
                xtype: 'container',
                height: 800
                },
                items: [{
                html: '<STRONG>TAB 1 your content here</STRONG>'
                }, {
                html: '<STRONG>TAB 2 your content here</STRONG>'
                }, {
                html: '<STRONG>TAB 3 your content here</STRONG>'
                }]
                }]
                });
                }
                });


                Working sample here






                share|improve this answer


























                  0












                  0








                  0







                  At first this functionality does not exist in the tabpanel, which I recommend you do and replace the idea of ​​tabpanel to apply a cardlayout which is the same tabpanel layout system.



                  And then you can use a toolbar, with the buttons being configured with the toogleGroup, in short, you'd better see the code example below working.



                  Ext.application({
                  name: 'Fiddle',
                  launch: function () {
                  Ext.create('Ext.Panel', {
                  fullscreen: true,
                  renderTo: Ext.getBody(),
                  layout: {
                  type: 'vbox',
                  align: 'stretch'
                  },
                  items: [{
                  xtype: 'toolbar',
                  height: 42,
                  defaults: {
                  xtype: 'button',
                  },
                  items: [{
                  text: 'Tab1',
                  handler: function(button){
                  var me = this,
                  fakeContainer = button.up('panel').down('#fakeTab');
                  fakeContainer.setActiveItem(button.tabIndex);
                  },
                  tabIndex: 0,
                  toggleGroup: 'tabHandler',
                  enableToggle: true,
                  pressed: true,
                  margin: '0'
                  }, {
                  text: 'Tab2',
                  handler: function(button){
                  var me = this,
                  fakeContainer = button.up('panel').down('#fakeTab');
                  fakeContainer.setActiveItem(button.tabIndex);
                  },
                  tabIndex: 1,
                  enableToggle: true,
                  margin: '0'
                  }, {
                  text: 'Tab3',
                  handler: function(button){
                  var me = this,
                  fakeContainer = button.up('panel').down('#fakeTab');
                  fakeContainer.setActiveItem(button.tabIndex);
                  },
                  tabIndex: 2,
                  toggleGroup: 'tabHandler',
                  enableToggle: true,
                  margin: '0'
                  }, '->', {
                  xtype: 'textfield',
                  fieldLabel: 'Search:',
                  labelWidth: 70,
                  width: 250,
                  margin: 0
                  }, {
                  iconCls: 'x-fa fa-search',
                  handler: function(){
                  alert('Your Search here!');
                  }
                  }]
                  }, {
                  xtype: 'container',
                  itemId: 'fakeTab',
                  margin: '16 0 0 0',
                  flex: 1,
                  layout: 'card',
                  defaults: {
                  xtype: 'container',
                  height: 800
                  },
                  items: [{
                  html: '<STRONG>TAB 1 your content here</STRONG>'
                  }, {
                  html: '<STRONG>TAB 2 your content here</STRONG>'
                  }, {
                  html: '<STRONG>TAB 3 your content here</STRONG>'
                  }]
                  }]
                  });
                  }
                  });


                  Working sample here






                  share|improve this answer













                  At first this functionality does not exist in the tabpanel, which I recommend you do and replace the idea of ​​tabpanel to apply a cardlayout which is the same tabpanel layout system.



                  And then you can use a toolbar, with the buttons being configured with the toogleGroup, in short, you'd better see the code example below working.



                  Ext.application({
                  name: 'Fiddle',
                  launch: function () {
                  Ext.create('Ext.Panel', {
                  fullscreen: true,
                  renderTo: Ext.getBody(),
                  layout: {
                  type: 'vbox',
                  align: 'stretch'
                  },
                  items: [{
                  xtype: 'toolbar',
                  height: 42,
                  defaults: {
                  xtype: 'button',
                  },
                  items: [{
                  text: 'Tab1',
                  handler: function(button){
                  var me = this,
                  fakeContainer = button.up('panel').down('#fakeTab');
                  fakeContainer.setActiveItem(button.tabIndex);
                  },
                  tabIndex: 0,
                  toggleGroup: 'tabHandler',
                  enableToggle: true,
                  pressed: true,
                  margin: '0'
                  }, {
                  text: 'Tab2',
                  handler: function(button){
                  var me = this,
                  fakeContainer = button.up('panel').down('#fakeTab');
                  fakeContainer.setActiveItem(button.tabIndex);
                  },
                  tabIndex: 1,
                  enableToggle: true,
                  margin: '0'
                  }, {
                  text: 'Tab3',
                  handler: function(button){
                  var me = this,
                  fakeContainer = button.up('panel').down('#fakeTab');
                  fakeContainer.setActiveItem(button.tabIndex);
                  },
                  tabIndex: 2,
                  toggleGroup: 'tabHandler',
                  enableToggle: true,
                  margin: '0'
                  }, '->', {
                  xtype: 'textfield',
                  fieldLabel: 'Search:',
                  labelWidth: 70,
                  width: 250,
                  margin: 0
                  }, {
                  iconCls: 'x-fa fa-search',
                  handler: function(){
                  alert('Your Search here!');
                  }
                  }]
                  }, {
                  xtype: 'container',
                  itemId: 'fakeTab',
                  margin: '16 0 0 0',
                  flex: 1,
                  layout: 'card',
                  defaults: {
                  xtype: 'container',
                  height: 800
                  },
                  items: [{
                  html: '<STRONG>TAB 1 your content here</STRONG>'
                  }, {
                  html: '<STRONG>TAB 2 your content here</STRONG>'
                  }, {
                  html: '<STRONG>TAB 3 your content here</STRONG>'
                  }]
                  }]
                  });
                  }
                  });


                  Working sample here







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 13 '18 at 19:26









                  Daniel da Cunha BuenoDaniel da Cunha Bueno

                  1416




                  1416






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53284731%2fadd-input-field-in-ext-tab-panel%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Full-time equivalent

                      Bicuculline

                      さくらももこ