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

Hello everybody.

My next notice is about following case. 

Suppose you have from PR301000, which has grid with id "grid" with button calculate. Also grid has column, which is bounded to column caculated, and you need the following:

If in selected row field "Calculated" is true, then disable button Calculate. If in selected row field "Calculated" is unchecked, then enable button calculate. 

In order to implement this following should be implemented:

1. In grid at page pr301000:

        <ActionBar ActionsText="True">

   <CustomItems>

                <px:PXToolBarButton Text="Calculate" DependOnGrid="grid" StateColumn="Calculated">

   <AutoCallBack Command="Calculate" Target="ds" >

                    </AutoCallBack>

   </px:PXToolBarButton>

            </CustomItems>

</ActionBar>

2. In ds section write the following:

<px:PXDataSource ID="ds" runat="server" Visible="True" Width="100%" PrimaryView="PayRolls" SuspendUnloading="False" TypeName="DS.PayRollManager">

        <CallbackCommands>

            <px:PXDSCallbackCommand Name="Calculate" Visible="False" DependOnGrid="grid">

            </px:PXDSCallbackCommand>

        </CallbackCommands>

</px:PXDataSource>

3. Declaration in dac class should be the following:

#region Calculated

public abstract class calculated : PX.Data.IBqlField

{

}

protected bool? _Calculated;

[PXDBBool()]

[PXDefault(false, PersistingCheck = PXPersistingCheck.Nothing)]

[PXUIField(DisplayName = "Calculated")]

public virtual bool? Calculated

{

get

{

return this._Calculated;

}

set

{

this._Calculated = value;

}

}

#endregion

after I implemented those changes button calculated taken into account field Calculated

No Comments

Add a Comment