SAP UI5 如何为 Process Flow Lane Header 设置颜色状态 [英] SAP UI5 how to set the colour state for the Process Flow Lane Header

查看:32
本文介绍了SAP UI5 如何为 Process Flow Lane Header 设置颜色状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在流程中遇到了一个问题.我试图将 ProcessFlowLaneHeader 的状态设置为 Positive,但我看不到绿色的节点.你能帮我解决这个问题吗?下面是我试过的代码..

Im facing an issue in Process Flow. Im trying to set the state of the ProcessFlowLaneHeader to Positive, But I'm not able to see the node in green colour. Can you please help me how can i fix this issue. Below is the code that i have tried..

<ui:ProcessFlow class="processFlow" scrollable="false" showLabels="false">                      
    <ui:lanes>
        <ui:ProcessFlowLaneHeader iconSrc="sap-icon://order-status" text="Apply" press="onNodeLeaveApply"
                            state="{[sap.suite.ui.commons.ProcessFlowNodeState.Positive]}" position="0"/>
        <ui:ProcessFlowLaneHeader state="{[sap.suite.ui.commons.ProcessFlowNodeState.Positive]}" iconSrc="sap-icon://customer" text="Review"
                            press="onNodeLeaveReview" position="1"/>
        <ui:ProcessFlowLaneHeader state="{[sap.suite.ui.commons.ProcessFlowNodeState.Positive]}" iconSrc="sap-icon://inventory" text="Sent"
                            press="onNodeLeaveSent" position="2"/>
    </ui:lanes>
</ui:ProcessFlow>

请在此处查看屏幕截图,我无法获得绿色节点..

Please check the screenshot here I'm not able to get the nodes in Green colour..

当我尝试通过按下节点从 Controller 更改节点时,它变为灰色(中性).下面是我的控制器代码.

When I tried to change the node from Controller by pressing the node, it is changing to grey(Neutral). Below is my Controller Code.

     onNodeLeaveApply:function(oEvent){

 oEvent.mParameters.oParent.mAggregations.lanes[0].setState(["sap.suite.ui.commons.ProcessFlowNodeState.Positive"]);
            },

请帮助我如何将状态更改为绿色(正)

Please help me how can I change the state to Green Colour(Positive)

提前致谢

推荐答案

抱歉,第一个答案草率且不正确.state 属性确实是一个数组对 { state, value }.press"的事件处理器可以访问ProcessFlowLaneHeader作为事件源,所以oEvent.mParameters.oParent.mAggregations.lanes[0]行应该改为oEvent.getSource():

Sorry, the first answer was hasty and incorrect. The state property is indeed an array of pairs { state, value }. The event handler of "press" can access the ProcessFlowLaneHeader as the source of the event, so oEvent.mParameters.oParent.mAggregations.lanes[0] line should be changed to oEvent.getSource():

onNodeLeaveApply: function(oEvent) {
    oEvent.getSource().setState([{
        state: sap.suite.ui.commons.ProcessFlowNodeState.Positive,
        value: 20
    },
    {
        state: sap.suite.ui.commons.ProcessFlowNodeState.Negative,
        value: 10
    }]);
}

代替 sap.suite.ui.commons.ProcessFlowNodeState.Negative 或 sap.suite.ui.commons.ProcessFlowNodeState.Positive,您可以使用字符串Negative"和Positive",结果相同:

Instead of sap.suite.ui.commons.ProcessFlowNodeState.Negative or sap.suite.ui.commons.ProcessFlowNodeState.Positive you can use strings "Negative" and "Positive" with the same result:

onNodeLeaveApply: function(oEvent) {
    oEvent.getSource().setState([{
                state: "Positive",
                value: 20
            },
            {
                state: "Negative",
                value: 10
            }]);
        }

这篇关于SAP UI5 如何为 Process Flow Lane Header 设置颜色状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆