Solved

Catching the row change event in a grid

  • 20 July 2023
  • 7 replies
  • 159 views

Userlevel 3
Badge

Hi,

I have a simple processing screen displaying records in a grid. Above the grid, I have some action buttons.

What I want to do

I'd like to change dynamically the accessibility of one of thses action buttons : if the selected record in the grid has some specific characteristics, the button is enabled, otherwise, it is disabled.

The problem  to solve

My problem is to catch the fact that a new row is selected in the grid : the RowSelected event is not invoked in this case.

Some technical details

The declaration of the graph :

public class EapActivityProcess : PXGraph<EapActivityProcess>

The declaration of the view

        public SelectFrom<EAPActivity>
            .OrderBy<Desc<EAPActivity.lastChangeDate>>
            .View.ReadOnly ActivityView;

This is the view used in the grid :

Anybody knows if it is possible ?

icon

Best answer by Naveen Boga 27 July 2023, 06:58

View original

7 replies

Badge +11

You need to set SyncPosition = true on the grid properties.

This will allow you to get the selected row with ActivityView.Current.

Userlevel 3
Badge

Thank you @darylbowman for your suggestion, I test it.

@Naveen Boga, I have joined the code of the used DAC. For the graph, I just have the view as described in my first post. I have added a _(Events.RowSelected<EAPActivity> e) method but it is not called on grid row selection change.

Userlevel 3
Badge

Hi @Chris Hackett !

It turned out that our needs changed and that we have given up the screen I began to work on. However, it is good to know how to do in such a case and I think that the solution exposed in this topic is a good way to do that. So, thank you to @darylbowman  and @Naveen Boga for their help.

To be completely honest, we turned to another scenario where we also need to detect when a row change in a grid, but where we do not have to enable or disable buttons. We have found a solution using the client event OnRowChanged of the grid.

Userlevel 7
Badge +17

Hi @ygagnaire12  Can you please share your code here for our review?

Userlevel 7
Badge +17

@ygagnaire12  As you mentioned above below link will fulfil your requirement.

https://stackoverflow.com/questions/47877150/is-there-any-event-triggered-when-highlighting-a-row

 

And to get the current row, you should use the View.Current. Let us know if you get any issues with this?

 

Userlevel 3
Badge

I just have found a reply that would partially fit my need :

https://stackoverflow.com/questions/47877150/is-there-any-event-triggered-when-highlighting-a-row

However, is it possible to get current record in the grid (I mean selected record). ?

 

Userlevel 7
Badge

Hi @ygagnaire12 were you able to find a solution? 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