You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

CodeRad中rowTemplate内Buttons组件不显示问题求助

CodeRad rowTemplate中Buttons组件limit属性未生效,溢出按钮不显示

我在CodeRad的rowTemplate里添加了Buttons组件,已经设置limit="1",但没出现预期的溢出按钮图标。当前所有按钮直接垂直排列在列表行下方,完全没有折叠效果。

相关代码

XML代码

<?xml version="1.0"?>
<border view-controller="MyGroupsPageViewController"
        rad-model="GroupModel"
        ...
    <define-category name = "MAIN_MENU"/>
   
     
    <entityList layout-constraint="center" name="groups" addAction="CREATE_GROUP_ACTION"
        provider="com.mgr.app.providers.MgrGroupsProvider.class">
        <row-template>
            <border uiid="groupContainer">

                <border layout-constraint="north">
                    <radLabel tag = "GroupModel.groupName" layout-constraint="north" component.uiid="GroupNameLabel"/>
                    <radSpanLabel tag = "GroupModel.groupDescription" layout-constraint="center" component.uiid="GroupDescriptionLabel"/>
                </border>
                <buttons actionCategory="MAIN_MENU" layout-constraint="south" uiid="GroupsButton" limit="1" layout="BoxLayout.y()"/>
            </border>
        </row-template>

    </entityList>

</border>

控制器代码

...
protected void initControllerActions() {
    super.initControllerActions();

    ActionNode.
            builder()
            .label("Contribute")
            .addToController(this, MyGroups.MAIN_MENU,this::contribute);
    ActionNode.
            builder()
            .label("Group Transactions")
            .addToController(this, MyGroups.MAIN_MENU,this::groupTransactions);
    ActionNode.
            builder()
            .label("My Transactions")
            .addToController(this, MyGroups.MAIN_MENU,this::myTransactionsInAGroup);

    ActionNode.
            builder()
            .label("Exit Group")
            .addToController(this, MyGroups.MAIN_MENU,this::exitGroup);

实际效果

4个按钮(Contribute、Group Transactions、My Transactions、Exit Group)在列表行下方垂直排列,未出现溢出折叠按钮。

解决方法

  1. 修改布局为水平排列
    当前设置的layout="BoxLayout.y()"是垂直布局,这种布局下组件会自动向下扩展空间,不会触发溢出判断。CodeRad的Buttons组件溢出功能仅在水平布局(BoxLayout.x())下生效,修改布局属性即可:

    <buttons actionCategory="MAIN_MENU" layout-constraint="south" uiid="GroupsButton" limit="1" layout="BoxLayout.x()"/>
    
  2. 校验actionCategory匹配
    确认XML中actionCategory="MAIN_MENU"和控制器里的MyGroups.MAIN_MENU是同一常量,避免因分类不匹配导致按钮数量统计错误。

  3. 排查UIID样式影响
    检查GroupsButton这个UIID是否设置了fillWidth等强制占满空间的属性,若组件空间足够容纳所有按钮,就不会触发溢出逻辑。可以暂时移除uiid="GroupsButton"测试是否恢复正常。

  4. 升级CodeRad版本
    部分旧版本CodeRad存在Buttons组件limit属性在rowTemplate中不生效的bug,尝试升级到最新稳定版。

内容的提问来源于stack exchange,提问作者ngosti

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.24 09:03:19