Skip to main content

By using PXUIFieldAttribute.SetEnabled we can access to the fields and modify their properties. I was wondering how.we can access to the standard buttons like as ok, cancel … on the smart panels and modify their properties?

Create a button for your smart panel and assign the dialog result to the desired option.

 

 

Than in your code you can access the action like any other. Make sure that the panel button is set to the correct CommandName and CommandSourceID.


 Hi @aaghaei  I just worked on a similar kind of requirement.

In the smart panel, I have added 3 buttons Add, Add&Close, and Cancel. Provided the command names at the Smart Panel (.aspx page)

In the Row_Selected event, written a condition like, if the provided value is less than 5 then I’m disabling the buttons (Add and Add&Close) and if the value is more than 5 then I’m enabling the smart panel buttons

 

Please find the screenshots for reference.

 

 

 


Thanks @Naveen B & @yhartman,

yes, with a little bit of help I figured this out. Here is what I did.

 

        protected virtual void APInvoice_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
var row = e.Row as APInvoice;
if (row != null)
{
bool Enabled = (row.Status == APStatuses.PendingApproval || row.Status == APStatuses.Rejected || row.Status == APStatuses.OnHold) ? true : false;
route.SetEnabled(Enabled);
}

if (RoutingPanelDialog.Current != null)
{
bool Enabled = false;
Enabled = (RoutingPanelDialog.Current.Status == EPStatuses.Routed) ? false : true;
PXUIFieldAttribute.SetEnabled<EPRoutingPanelDialog.step>(cache, null, Enabled);

Enabled = false;
if (RoutingPanelDialog.Current.Step != null)
{
if (RoutingPanelDialog.Current.Owner != null || RoutingPanelDialog.Current.Workgroup != null)
{
Enabled = true;
}
}

ChangeOk.SetEnabled(Enabled);
}
}

 


Reply