Skip to main content

Supposed you have a form grid screen. Form at the top and grid beneath. The grid DAC is a child of the form DAC. How do I disable the standard add row button on the grid toolbar in parent Graph. .This may be based on some conditions or value from the parent DAC ]

Hi @robert38,

In the RowSelected event you can set AllowInsert to false for the grid view. Below is an example that disables insert in the Sales Order screen,

 

    public class SOOrderEntry_Extension : PXGraphExtension<PX.Objects.SO.SOOrderEntry>
    {
        #region Event Handlers

        protected void SOOrder_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected baseHandler)
        {
            baseHandler?.Invoke(cache, e);
            var row = (SOOrder)e.Row;
            //Condition as requried
            Base.Transactions.AllowInsert = false;
        }

}

 

Thanks, 


Hello @robert38,
Also you can add <Mode AllowAddNew="false"></Mode> to aspx inside px:Grid section where you want to disable add button. On screen it will look like this. But it’s better to use if you will never need this button

 


Reply