Search code examples
c#acumaticaacumatica-kb

Assigning Action to a custom Button and UI layout issue


I ran into two issues while working on the UI of the form:

  1. I created an Action but I can't seem to assign it to the new button that I've created. It appeared on toolbar instead as highlighted in red box here. The code on the Action and Button:

     public PXAction<CashAccount> RefreshAvailability;
     [PXButton(CommitChanges = true)]
     [PXUIField(MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select, Enabled = true)]
    
     protected virtual void refreshLCAvailability()
     {
         //logic here
     }
    
  2. I inserted two Column controls to separate the fields into two columns as shown here but the output is not like what I wanted it to be as shown in the image in point 1.

I feel like I'm missing something very simple but can't seem to figure what.

Edit:

The first issue has been solved by assigning the Command as well as the Target as shown here.


Solution

  • I managed to solve the second issue by trial and error. So basically, you need to:

    1. Insert an Empty Layout control after Merge control
    2. Specify the Merge property as False

    Image for point 1 & 2

    1. Insert another Column in between the two
    2. Insert a Label control in the newly created Column
    3. Leave the Label Text as blank

    Image for point 3, 4 & 5

    It is mind boggling that I have to do it in this roundabout way. If there is any better way of doing this, please do share it in this thread.