Is there any event triggered when highlighting a row?

心不动则不痛 提交于 2019-12-01 13:57:06

To reduce callback to the server there isn't a row selected event. Instead there is PXToolbarButton StateColumn property to control the button enabled state.

When you declare your button, you specify a Boolean DAC field that will enable/disable the button based on it's value. Note that the button needs the DependOnGrid property set to the ID of the grid to get the selected row:

<px:PXToolBarButton Text="Button A" DependOnGrid="grid" StateColumn="IsButtonVisible">

IsButtonVisible is a custom unbound Boolean DAC field (you may choose any name you want except isSelected/Selected which is reserved for checkbox):

#region IsButtonVisible
public abstract class isButtonVisible : IBqlField
{
}

protected bool? _IsButtonVisible;
[PXBool]
[PXUIField(DisplayName = "Is Button Visible", Enabled = false, Visible = false)] 
public virtual bool? IsButtonVisible
{
    get
    {
        return _IsButtonVisible;
    }
    set
    {
        _IsButtonVisible = value;
    }
}
#endregion

You can set the value of IsButtonVisible in the RowSelected event based on your business logic:

protected virtual void DAC_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
    DAC row = e.Row as DAC;

    if (row != null)
    {
        bool yourCondition = ???;
        row.IsButtonVisible = yourCondition;
    }
}

Source: Enable disable button of grid or PXToolBarButton, which depends from value of column in Acumatica

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!