ExtJS 门户和 portlet 可以像通常的 CSS 元素一样定位吗?

发布于 2024-11-03 16:38:41 字数 300 浏览 2 评论 0原文

我想让一个门户及其 ExtJS portlet 适合固定宽度的布局。现在它们似乎占据了 100% 的宽度,并且元素似乎应用了内联样式来提供最大宽度,而为门户项目指定“width: 50%”样式之类的技巧似乎没有任何作用。

如何调整 Portlet 的大小和位置?是否有任何方法可以应用常用的 CSS 定位技巧?生成的 HTML 出现在 Inspect Element 上时具有指定宽度(以像素为单位)的内联样式,这将胜过我在样式表中放置的任何内容。

我希望像常规块元素一样显示门户,并在页面内进行相对定位。这可能吗?如果不可能,我的下一个最佳选择是什么?

I would like to make a portal and its ExtJS portlets fit within a fixed-width layout. Right now they seem to take 100% of the width, and the elements appear to have inline styles applied to give max width, and tricks like specifying a style of "width: 50%" for the portal's items do not appear to do anything.

How can portlets be sized and positioned, and is there any way to apply usual CSS positioning skill? The generated HTML as it appears on Inspect Element has an inline style specifying a width in pixels, which will trump whatever I put in a stylesheet.

I would like to have a portal be displayed like a regular block element with relative positioning within a page. Is that possible, and if not, what are my next best options?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

野心澎湃 2024-11-10 16:38:41

Portlet 由布局管理,布局用于设置大小、响应视口调整大小等。您必须修改现有布局或创建您自己的自定义布局才能执行此操作(或者构建您自己的门户,该门户不基于现有的例子)。

The portlets are managed by a layout, which is what sets sizes, responds to viewport resizes, etc. You would have to modify the existing layout or create your own custom layout to do this (or else build your own portal that's not based off of the existing example).

温折酒 2024-11-10 16:38:41

看来我已经有了答案。覆盖视口定义以自定义 div 标签的渲染。这是我的代码:

Ext.override(Ext.container.Viewport, {
initComponent : function() {
    var me = this,
        html = Ext.fly(document.body.parentNode),
        el;
    me.callParent(arguments);
    html.addCls(Ext.baseCSSPrefix + 'viewport');
    me.el = el = 'dashboard';
    el.setHeight = Ext.emptyFn;
    el.setWidth = Ext.emptyFn;
    el.setSize = Ext.emptyFn;
    me.allowDomMove = false;
    Ext.EventManager.onWindowResize(me.fireResize, me);
    me.renderTo = me.el;
    me.height = Ext.Element.getViewportHeight() - 70;
}});

其中 me.el 是元素渲染的 id。

it seems i have the answer. Overwrite the viewport definition for customize the render to a div tag. Here is my code:

Ext.override(Ext.container.Viewport, {
initComponent : function() {
    var me = this,
        html = Ext.fly(document.body.parentNode),
        el;
    me.callParent(arguments);
    html.addCls(Ext.baseCSSPrefix + 'viewport');
    me.el = el = 'dashboard';
    el.setHeight = Ext.emptyFn;
    el.setWidth = Ext.emptyFn;
    el.setSize = Ext.emptyFn;
    me.allowDomMove = false;
    Ext.EventManager.onWindowResize(me.fireResize, me);
    me.renderTo = me.el;
    me.height = Ext.Element.getViewportHeight() - 70;
}});

where me.el is the id of element render.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文