Solved

What events fire when you click + on a grid to add a new line?

  • 5 July 2023
  • 5 replies
  • 88 views

Userlevel 6
Badge +3

I have a grid that looks like this:

When I click + to add a new line item, I want to default the value in the Greater Than field to the Less Than value in the previous line.

I can get it to work, but no matter which event handler I use, it only will do the update to the field AFTER I leave the line.

Enter 6000 in the less than field

 Tab out of the line and the 5000 gets populated.

I am using the FieldDefaulting handler to get the previous line and update the newvalue for the row being defaulted.

NOTE...this code WORKS, but it only fires AFTER you leave the line.  When the current row has a SortOrder of zero, this tells me that this is a new row and to get the previous row.

		protected void ICSPricingMatrix_FromPrice_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e)
{
var row = (ICSPricingMatrix)e.Row;
if (row == null) return;

if (row.SortOrder == 0)
{
ICSPricingMatrix prevItem = SelectFrom<ICSPricingMatrix>
.Where<ICSPricingMatrix.priceClassID.IsEqual<@P.AsString>>.AggregateTo<Max<ICSPricingMatrix.sortOrder>>
.View.Select(this, row.PriceClassID);
if (prevItem != null)
{
e.NewValue = prevItem.ToPrice;
}
}
}

Shouldn’t FieldDefaulting fire as soon as I click the plus sign?  What the heck does fire when you click the plus sign?

 

 

icon

Best answer by Naveen Boga 6 July 2023, 06:25

View original

5 replies

Userlevel 4
Badge +1

@Joe Schmucker RowInserting

 

 

Userlevel 6
Badge +3

@girik06 I set a breakpoint on RowInserting and it is not fired until after I tab off the last line of the grid.

When I click the add icon, this does not get fired.  As soon as I leave the row, it fires.

Userlevel 7
Badge +17

Hi @Joe Schmucker  To fire this event, you need to add the below syntax in the .aspx page otherwise it won’t be invoked.

 

   <Mode InitNewRow="True"  AllowUpload="True" AllowDragRows="true" />

 

 

Userlevel 6
Badge +3

@Naveen Boga Are you kidding me???  I spent 3 hours trying to figure this out and it is that simple?  OMG.  Lesson learned.  Thank you for your help AGAIN!

We love you Naveen!

Userlevel 7
Badge +17

@Joe Schmucker  It happens sometimes!! :) 

Thank you for your kind words! I'm glad I could assist you in resolving the issue. :) 

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