小编Rob*_*ter的帖子

如何在特定位置(索引)添加ExtJs组件?

我有一个带有一些组件的ToolBar(TextFields和Buttons),我想在其他组件之前动态添加一个组件(例如TextField).

我尝试tbBar.add(myComponent);没有成功.

任何的想法?

extjs extjs4 extjs3

10
推荐指数
1
解决办法
1万
查看次数

如何在Extjs TabPanel的选项卡中添加工具?

如何在TabControl中的每个选项卡的标题中添加按钮(工具)?

我只是可以在TabPanel中添加工具,但我想在选项卡中添加.

图片

我也试过这个,但没有成功:

      var lTabPanel = Ext.create('Ext.tab.Panel', {
      width: 400,
      height: 400,
      renderTo: document.body,
      items: [{
          title: 'Home',
          html: 'Home',
          itemId: 'home'
      }, {
          title: 'Users',
          html: 'Users',
          itemId: 'users',
          hidden: true
      }, {
          title      : 'Tickets',
          html       : 'Tickets',
          itemId     : 'tickets',
          tools:[{
            type:'gear',
            tooltip: 'Options',
            handler: function(event, toolEl, panel){
                // Some code.
            }
          }]

      }]
  });
Run Code Online (Sandbox Code Playgroud)

任何的想法?

谢谢!

extjs extjs4 extjs3

5
推荐指数
1
解决办法
1万
查看次数

如何获得菜单的父级?

我正试图将菜单链接起来.看一看:

    Ext.create('Ext.Button', {
    id: 'MyButton',
    text: 'Click me',
    renderTo: Ext.getBody(),
    menuAlign: 'tl-bl',
    menu: {
        itemId: 'MyMenu',        
        forceLayout: true,
        items:
        [
            {
                text  : 'Option 1',
                itemId: 'MyItemMenu1'
            }, {
                text  : 'Option 2',
                itemId: 'MyItemMenu2'
            }, {
                text   : 'Get the parent!',
                itemId : 'MyItemMenu3',
                handler: function(){

                    // Get the item menu.
                    var MyItemMenu3 = this; 
                    alert(MyItemMenu3.getItemId()); 

                    // Get the menu.
                    var MyMenu = MyItemMenu3.ownerCt; 
                    alert(MyMenu.getItemId());

                    // Try to get the button.
                    var MyButton = MyMenu.ownerCt; 
                    alert(MyButton);                    

                    // Returns:                    
                    // …
Run Code Online (Sandbox Code Playgroud)

extjs extjs4 extjs3

5
推荐指数
1
解决办法
7075
查看次数

Delphi:我应该使用重载,重新引入+重载还是不重载?

在子类中有一个在子类中重写的虚方法.

但是,我需要在子类方法中添加一个新参数,因为参数不同,所以不可能使用"override"声明.

例:

type
  TFruit = class(TObject)
  public
    constructor Create; virtual;
  end;

  TApple = class(TFruit)
  public
    constructor Create(Color: TColor); override; // Error: Declaration of 'Create' differs from previous declaration
  end;
Run Code Online (Sandbox Code Playgroud)

我知道在这种情况下一个好的做法是用另一个名称创建一个新方法,但是很多代码都是多余的.这个新参数只会影响几行......

然后我想到使用"重载",但后来我不能一起使用"覆盖".所以我问:只有使用"过载"有什么问题吗?(Delphi显示警告:方法'创建'隐藏基本类型'TFruit'的虚拟方法)

我还检查了使用重新引入+重载(隐藏上面的警告),但我也看到了关于这种做法的错误建议.你怎么看?

最后,如果我不使用它们,只是删除子类方法中的"覆盖"并添加新的参数?(这给了我同样的警告)

任何人都对我在这种情况下应该做些什么有任何建议,以保持良好做法?

type
  TFruit = class(TObject)
  public
    constructor Create; virtual;
  end;

  TApple = class(TFruit)
  public
    constructor Create; override;

    // What should I do:
    //  constructor Create(Color: TColor); overload; // Shows a warning
    //  constructor Create(Color: TColor); reintroduce; overload; // Hides the warning
    //  constructor Create(Color: TColor); // …
Run Code Online (Sandbox Code Playgroud)

delphi delphi-xe

3
推荐指数
1
解决办法
972
查看次数

标签 统计

extjs ×3

extjs3 ×3

extjs4 ×3

delphi ×1

delphi-xe ×1