extjs 3.3: floating panel

2019-02-26 15:27发布

问题:

I am trying to create a floating panel over other pre-created panels, I tried following simple codes, but failed:

var testPanel = new Ext.Panel({
                                id: 'testP',
                                width: 50,
                                height: 100,
                                floating: true,
                                title:'Test'
                            });
testPanel.show();

what else I need to think about?

thanks!

回答1:

Following needs to be taken care of when using the floating config:

1) Fixed width - which you've done 2) The position must be set explicitly after render (e.g., myPanel.setPosition(100,100);).

You can also set the underlying Ext.Layer config option instead of just setting floating : true. You can do that in the following way:

Ext.Panel({

  //.. other config..,
  floating : {
    //Ext.Layer config options. Maybe a property in that will get you the desired effect that you're looking for.
  }
});

Try this and update!

Cheers.