extjs - 如何在一行 AEM 对话框中创建文本字段(经典 UI)

标签 extjs aem

AEM Dialog Image

上面的字段分为 2 行。我希望他们都排成一排。

使用的代码是:

<provinces jcr:primaryType="cq:Widget" fieldLabel="Province List" name="./provinces" xtype="multifield">
<fieldConfig
    jcr:primaryType="cq:Widget"
    xtype="multifieldpanel">
    <items jcr:primaryType="cq:WidgetCollection">
        <code
            jcr:primaryType="cq:Widget"
            fieldLabel="Code"
            key="code"
            xtype="textfield"/>
        <name
            jcr:primaryType="cq:Widget"
            fieldLabel="Name"
            key="name"
            xtype="textfield"/>
    </items>
</fieldConfig>

最佳答案

您应该为多字段使用 hbox 布局。将 layout="hbox" 添加到带有 xtype="multifieldpanel" 的节点,它应该可以工作。

Tested on my AEM 6.3 local instance

您的特定对话框代码变为:

<fieldConfig
    jcr:primaryType="cq:Widget"
    layout="hbox"
    xtype="multifieldpanel">
    <items jcr:primaryType="cq:WidgetCollection">
        <code
            jcr:primaryType="cq:Widget"
            fieldLabel="Code"
            key="code"
            xtype="textfield"/>
        <name
            jcr:primaryType="cq:Widget"
            fieldLabel="Name"
            key="name"
            xtype="textfield"/>
    </items>
</fieldConfig>

If you're interested in documentation, see the layout config option in the CQ.form.MultiField ExtJs documentation for AEM. You might be interested in the other layout options.

For future reference, when you have questions about classic UI widgets, try searching for that issue with extjs keyword, you'll find many articles that might help. For example, for this solution, I got the hint from this SO question and I found that SO question by searching "extjs in same row" then looked up the extjs AEM docs to see if there was a layout option for the multifield widget.

关于extjs - 如何在一行 AEM 对话框中创建文本字段(经典 UI),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51209790/

相关文章:

user-interface - ExtJS 3.x 和 ExtJS 5 可以在单个应用程序中共存吗?

extjs - 在extjs中通过名称获取组件

aem - 将选择下拉列表添加到对话框窗口

java - 从 CQ5.5 索引中获取搜索词建议

javascript - AEM 获取子节点内容

javascript - 出现错误 : Uncaught TypeError: Cannot read property 'parentNode' of null

javascript - 如果加载失败,是否有更好的方法在 app.js 脚本标记上添加 onerror 回调?

javascript - 为什么我不能使用Ext.grid.Grid?

javascript - 在 CQ5 中设置自定义多字段元素的最小值和最大值?

maven - 我们如何为pom.xml创建一个build.gradle等效文件来构建和部署AEM代码?