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
Ready to take your Acumatica customization to the next level? Just like we demonstrated how to dynamically enable or disable the "Calculate" button based on the "Calculated" field in PR301000, your business processes can also benefit from tailored solutions. Whether it’s enhancing grid functionality, automating workflows, or integrating custom logic, our team is here to help.
Leave a customization request today! Share your unique requirements, and let’s build a solution that fits your business like a glove. Your vision, our expertise—let’s make it happen together.