Question

How to get mode value of a form whether it is form mode or grid mode in RowSelected EventHandler?

  • 22 June 2022
  • 5 replies
  • 125 views

Userlevel 4
Badge +1

Hi Everyone, Hope you are doing well.

 

Based on the form mode value, I want to show and hide some fields in the RowSelectedEvent handler.

If the form is in grid mode then I need to show all the fields and If the form is in FormView mode then I want to hide some fields. 

 

Could you please suggest to me how to achieve this functionality?


5 replies

Userlevel 7
Badge +17

Hi @MoulaliShaik79  As per my understanding, based on the MODE condition you do not want to update/delete the grid records by hiding the fields.

I’m not sure that we can hide the fields in the grid, but you can make it read-only buttons.

Here is the sample code and hope this helps

 

  public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>
{
protected virtual void SOLine_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
InvokeBaseHandler?.Invoke(cache, e);
SOLine row = e.Row as SOLine;
if (row != null)
{

if (Base.Document.Current != null && !string.IsNullOrEmpty(Base.Document.Current.OrderDesc) && Base.Document.Current.OrderDesc.Trim() == "TEST")
{
cache.AllowUpdate = false;
cache.AllowDelete = false;

}
}
}

}

 

Userlevel 4
Badge +1

Hi @Naveen Boga 

 Thanks for the suggestion but is there any way to get the mode value inside the RowSelected EventHandler? or Is there any specific property that indicates that the form is in Grid/FormViewMode?.

 

 

Thanks,

Moulali Shaik.

Userlevel 7
Badge +17

Hi @MoulaliShaik79  I’m a bit confused. I thought Mode is field in the header level and based on that you wanted to edit/delete the records in the grid.

 

Can you please elaborate the requirement details?

Userlevel 4
Badge +1

Hi @Naveen Boga 

I have created 2 Data-Views to get the same data. One Data-View was applied to the grid and another was applied to the form. Whenever I click on the grid row then it has to show its corresponding HTML value in the form. like the below:

 

If I click on the second row of the grid then it has to show its corresponding HTML value in the form.

The above functionality is working fine here without any issue. Now the problem is:

When I changed the view from grid to Form. The below screen appears:

The First, next, previous and last buttons are applied to the Grid-from view mode.

If I click on the Next button then the below Form value is not changing based on the above grid value.

So, Here, I have added the Html editor in the form view of the first Data View. Here the HTML Editor is duplicating (like 2 times showing). So, If I know the Mode of the screen then I can try to hide the second Data-View Html editor to remove duplicates.

 

 

Thanks,

Moulali Shaik.

Userlevel 7
Badge

Hi @MoulaliShaik79 - were you able to find a solution for your issue? Thank you!

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved