button - Hybris HMC : adding a button to ToolBarChip/Editor window next to the save button

标签 button toolbar sap-commerce-cloud

我正在使用 Hybris 5.6,并尝试在编辑器区域中保存/重新加载/删除按钮旁边添加一个按钮。

如何向 ToolBarChip 添加按钮,如下例所示?

enter image description here

最佳答案

很有可能向 HMC 的工具栏添加新操作(标签),但是不建议这样做,因为这可能会在迁移时导致一些问题

  1. 首先,将以下代码段添加到您的 **/hmc.xml 中:
<type name="AbstractOrder" mode="append">

  <organizer mode="append" > 
     <editor>
        <tab name="payment_and_delivery" position="2" mode="append">

           <section name="deliveryadministration" mode="append" >
              <table>
                 <tr>
                    <td width="16px">
                    </td>
                    <td>
                       <!-- here is the interesting part -->
                       <action type="item"
                               classname="com.foo.bar.MyNewAction" 
                               name="action.my_new_action"
                               toolbaricon="my_new_action"
                               icon="images/icons/my_new_action_icon.gif"
                               autosave="true"
                               showtoolbarlabel="true"
                               hidebutton="true"
                             />
                    </td>

                 </tr>
              </table>
           </section>

        </tab>
     </editor>
  </organizer>

</type>
  • 然后,定义单击新标签时要执行的新操作:

    添加一个名为 MyNewAction.java 的新类,该类从 ItemAction 扩展并实现方法 ActionResult Perform(ActionEvent event) :
  • public MyNewAction extends ItemAction {
    
        @Override
        public ActionResult perform(ActionEvent actionEvent) throws JaloBusinessException {
    
            //what the new action should do here ...
    
        }
    }
    

    注意:您可以在操作执行时重写其他有趣的方法作为触发器:boolean needConfirmation()String getConfirmationMessage() ...

    结果会是这样的:

    enter image description here

    关于button - Hybris HMC : adding a button to ToolBarChip/Editor window next to the save button,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42528745/

    相关文章:

    javascript - 如何替换 JQuery 属性中的子字符串

    java - 工具栏中的自定义布局

    sap-commerce-cloud - Smartedit 类型错误 : Cannot read property 'siteId' of undefined

    java - 为什么 Hybris 中的促销引擎无法正常工作?

    c# - 如何使按钮在运行时调整大小?

    jQuery CSS 主题滚动器

    Android:在自定义按钮中使用默认突出显示颜色

    android - android studio 中不是全宽工具栏?

    android - collapsingToolbarLayout 仅在折叠时设置标题

    sap-commerce-cloud - Hybris如何获取属性的标签?