how to enabled/disabled
add/edit/delete
toolbar
button in row selection in Acumatica PXGrid
?
I saw below post but i don't want to use this because i am using Acumatica
existing Form
view, i don't want to affect their form
if our custom funcationality not available. Is there a way to use row selection
event to enable/disabled toolbar button
or any other way to disabled buttons?
You should be able to override the RowSelected event handler (as you asked) to modify access to AllowUpdate, AllowInsert, and AllowDelete on the cache associated to that grid.
If the cache is already being set and you want to disable it, you can simply set the related cache.Allow--- to false based on your condition.
if(myAddCondition == true) MyViewName.AllowInsert = false;
if(myUpdateCondition == true) MyViewName.AllowUpdate = false;
if(myDeleteCondition == true) MyViewName.AllowDelete = false;
Remember that this will not inherently enable it again for the next row, so if you don't have code that already sets enable/disable, you should use the syntax:
MyViewName.AllowInsert = (myAddCondition == true);
MyViewName.AllowUpdate = (myUpdateCondition == true);
MyViewName.AllowDelete = (myDeleteCondition == true);
Be mindful that the base graph that you are modifying may have disabled the action on the cache already, so you want to be careful that you are not enabling it again unless you truly intend to do so.
Under certain conditions, you may need to refer specifically to the Cache of the view...
MyViewName.Cache.Allow[Insert/Update/Delete]