unable to fire the fieldupdated or rowupdated event on GL404000 screen - acumatica

I'm trying to extend the AccountByPeriodEnq business logic, yet i'm facing the following problem :
I can't seem to fire the GLTranR_RowUpdated or GLTranR_Selected_FieldUpdated events. (Unless I click the refresh button, then the events are fired)
Here's my code :
#region EventHandler
protected void GLTranR_Selected_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e, PXFieldUpdated del)
{
del?.Invoke(cache, e);
var row = (GLTranR)e.Row;
}
protected void GLTranR_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e)
{
var row = (GLTranR)e.Row;
}
#endregion
When I put a breakpoint on any of those methods, it never actually break.
It seems the original event is never fired as well (Located in AccountByPeriodEnq.cs graph) since I never see the Reclassify button being disabled.
protected virtual void GLTranR_Selected_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
{
reclassify.SetEnabled(GetSelectedTrans().Any());
}
I have checked in the aspx and the commitchanges=true is set for the "Selected" field.
Here's the aspx :
<%# Page Language="C#" MasterPageFile="~/MasterPages/FormDetail.master" AutoEventWireup="true"
ValidateRequest="false" CodeFile="GL404000.aspx.cs" Inherits="Page_GL404000"
Title="Untitled Page" %>
<%# MasterType VirtualPath="~/MasterPages/FormDetail.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="phDS" runat="Server">
<px:PXDataSource ID="ds" runat="server" Visible="True" Width="100%" TypeName="PX.Objects.GL.AccountByPeriodEnq"
PrimaryView="Filter" PageLoadBehavior="PopulateSavedValues">
<CallbackCommands>
<px:PXDSCallbackCommand CommitChanges="True" Name="previousperiod" HideText="True"/>
<px:PXDSCallbackCommand CommitChanges="True" Name="nextperiod" HideText="True"/>
<px:PXDSCallbackCommand DependOnGrid="grid" Name="Reclassify" CommitChanges="True"/>
<px:PXDSCallbackCommand DependOnGrid="grid" Name="ReclassifyAll"/>
<px:PXDSCallbackCommand DependOnGrid="grid" Name="ReclassificationHistory" StateColumn="IncludedInReclassHistory"/>
</CallbackCommands>
</px:PXDataSource>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="phF" runat="Server">
<px:PXFormView ID="form" runat="server" Width="100%"
Caption="Selection" DataMember="Filter" DefaultControlID="edFinPeriodID" DataSourceID="ds" TabIndex="100">
<Template>
<px:PXLayoutRule runat="server" StartColumn="True" LabelsWidth="SM" ControlSize="M" ></px:PXLayoutRule>
<px:PXSelector CommitChanges="True" ID="edOrganizationID" runat="server" DataField="OrganizationID"></px:PXSelector>
<px:PXSegmentMask CommitChanges="True" ID="edBranchID" runat="server" DataField="BranchID" Autorefresh="true"></px:PXSegmentMask>
<px:PXSelector CommitChanges="True" ID="edLedgerID" runat="server" DataField="LedgerID" Autorefresh="true"></px:PXSelector>
<px:PXSelector CommitChanges="True" ID="edStartPeriodID" runat="server" DataField="StartPeriodID"></px:PXSelector>
<px:PXSelector CommitChanges="True" ID="edEndPeriodID" runat="server" DataField="EndPeriodID" Autorefresh="True"></px:PXSelector>
<px:PXSegmentMask CommitChanges="True" ID="edAccountID" runat="server" DataField="AccountID"></px:PXSegmentMask>
<px:PXSegmentMask CommitChanges="True" ID="edSubID" runat="server" DataField="SubID" SelectMode="Segment" ></px:PXSegmentMask>
<px:PXLayoutRule runat="server" StartColumn="True" LabelsWidth="SM" ControlSize="S" ></px:PXLayoutRule>
<px:PXDateTimeEdit CommitChanges="True" ID="edStartDateUI" runat="server" DataField="StartDateUI" ></px:PXDateTimeEdit>
<px:PXDateTimeEdit CommitChanges="True" ID="edPeriodStartDate" runat="server" DataField="PeriodStartDateUI" ></px:PXDateTimeEdit>
<px:PXDateTimeEdit CommitChanges="True" ID="edEndDateUI" runat="server" DataField="EndDateUI" ></px:PXDateTimeEdit>
<px:PXDateTimeEdit CommitChanges="True" ID="edPeriodEndDateUI" runat="server" DataField="PeriodEndDateUI" ></px:PXDateTimeEdit>
<px:PXNumberEdit runat="server" ID="CstPXNumberEdit1" DataField="UsrCreditTotal" CommitChanges="True" />
<px:PXNumberEdit runat="server" ID="CstPXNumberEdit2" DataField="UsrDebitTotal" CommitChanges="True" />
<px:PXNumberEdit runat="server" ID="CstPXNumberEdit14" DataField="UsrSolde" CommitChanges="True" />
<px:PXLayoutRule runat="server" StartColumn="True" SuppressLabel="True" ></px:PXLayoutRule>
<px:PXCheckBox CommitChanges="True" ID="chkShowSummary" runat="server" DataField="ShowSummary" ></px:PXCheckBox>
<px:PXCheckBox CommitChanges="True" ID="chkIncludeUnposted" runat="server" DataField="IncludeUnposted" ></px:PXCheckBox>
<px:PXCheckBox CommitChanges="True" ID="chkIncludeUnreleased" runat="server" DataField="IncludeUnreleased" ></px:PXCheckBox>
<px:PXCheckBox CommitChanges="True" ID="chkIncludeReclassified" runat="server" DataField="IncludeReclassified" ></px:PXCheckBox>
<px:PXCheckBox CommitChanges="True" ID="chkShowCuryDetail" runat="server" DataField="ShowCuryDetail" ></px:PXCheckBox>
<px:PXLayoutRule runat="server" StartColumn="True">
</px:PXLayoutRule>
<px:PXNumberEdit ID="edBegBal" runat="server" DataField="BegBal">
</px:PXNumberEdit>
<px:PXNumberEdit ID="edTurnOver" runat="server" DataField="TurnOver">
</px:PXNumberEdit>
<px:PXNumberEdit ID="edEndBal" runat="server" DataField="EndBal">
</px:PXNumberEdit>
<px:PXGroupBox runat="server" ID="groupAffichage" Caption="Afficher" CommitChanges="True" DataField="UsrAffichage" RenderSimple="True" RenderStyle="RoundBorder">
<ContentLayout Layout="Stack" />
<Template>
<px:PXRadioButton runat="server" ID="CstRadioButton15" Text="Tous" Value="0" Checked="False" GroupName="groupAffichage" />
<px:PXRadioButton runat="server" ID="CstRadioButton16" Value="1" Text="Lettres" GroupName="groupAffichage" Checked="False" />
<px:PXRadioButton runat="server" ID="CstRadioButton17" GroupName="groupAffichage" Value="2" Text="Non lettres" Checked="True" /></Template></px:PXGroupBox></Template>
</px:PXFormView></asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="phG" runat="Server">
<px:PXGrid ID="grid" runat="server" Height="150px"
Width="100%" AllowPaging="True" AdjustPageSize="Auto" Caption="Summary By Period" SyncPosition ="True" FastFilterFields="TranDesc,RefNbr,"
BatchUpdate="True" AllowSearch="True" SkinID="PrimaryInquire" RestrictFields="True" DataSourceID="ds" TabIndex="100" PreserveSortsAndFilters="False">
<CallbackCommands>
<Refresh RepaintControlsIDs="form"/>
</CallbackCommands>
<AutoSize Container="Window" Enabled="True" />
<Mode AllowAddNew="False" AllowDelete="False" />
<Levels>
<px:PXGridLevel DataMember="GLTranEnq">
<Columns>
<px:PXGridColumn DataField="Selected" TextAlign="Center" Type="CheckBox" Width="30px" AllowCheckAll="True" AllowShowHide="Server" CommitChanges="True"></px:PXGridColumn>
<px:PXGridColumn DataField="Module" Width="100px" ></px:PXGridColumn>
<px:PXGridColumn DataField="BatchNbr" Width="100px" LinkCommand="ViewBatch" ></px:PXGridColumn>
<px:PXGridColumn DataField="TranDate" Width="100px" ></px:PXGridColumn>
<px:PXGridColumn DataField="FinPeriodID" Width="100px" ></px:PXGridColumn>
<px:PXGridColumn DataField="TranDesc" Width="224px" ></px:PXGridColumn>
<px:PXGridColumn DataField="RefNbr" Width="100px" LinkCommand="ViewDocument" ></px:PXGridColumn>
<px:PXGridColumn DataField="LineNbr" TextAlign="Right" Width="100px" ></px:PXGridColumn>
<px:PXGridColumn DataField="BranchID" Width="100px" ></px:PXGridColumn>
<px:PXGridColumn DataField="AccountID" Width="108px" ></px:PXGridColumn>
<px:PXGridColumn DataField="SubID" Width="198px" ></px:PXGridColumn>
<px:PXGridColumn DataField="SignBegBalance" TextAlign="Right" Width="100px" ></px:PXGridColumn>
<px:PXGridColumn DataField="DebitAmt" TextAlign="Right" Width="100px" ></px:PXGridColumn>
<px:PXGridColumn DataField="CreditAmt" TextAlign="Right" Width="100px" ></px:PXGridColumn>
<px:PXGridColumn DataField="SignEndBalance" TextAlign="Right" MatrixMode="True" Width="100px" ></px:PXGridColumn>
<px:PXGridColumn DataField="CuryID" AllowShowHide="Server" ></px:PXGridColumn>
<px:PXGridColumn DataField="SignCuryBegBalance" TextAlign="Right" Width="100px" AllowShowHide="Server" ></px:PXGridColumn>
<px:PXGridColumn DataField="CuryDebitAmt" TextAlign="Right" Width="100px" AllowShowHide="Server" ></px:PXGridColumn>
<px:PXGridColumn DataField="CuryCreditAmt" TextAlign="Right" Width="100px" AllowShowHide="Server" ></px:PXGridColumn>
<px:PXGridColumn DataField="SignCuryEndBalance" TextAlign="Right" Width="100px" AllowShowHide="Server" ></px:PXGridColumn>
<px:PXGridColumn DataField="InventoryID" Width="120px" ></px:PXGridColumn>
<px:PXGridColumn DataField="ReferenceID" Width="120px" ></px:PXGridColumn>
<px:PXGridColumn DataField="ReferenceID_BaccountR_AcctName" Width="200px" ></px:PXGridColumn>
<px:PXGridColumn DataField="ReclassBatchNbr" TextAlign="Right" Width="120px" AllowShowHide="Server" LinkCommand="ViewReclassBatch" ></px:PXGridColumn>
<px:PXGridColumn DataField="IncludedInReclassHistory" AllowShowHide="False" Visible="false" SyncVisible="false" ></px:PXGridColumn>
<px:PXGridColumn DataField="UsrLettrageNbr" Width="70" CommitChanges="True" /></Columns>
</px:PXGridLevel>
</Levels>
<AutoSize Container="Window" Enabled="True" MinHeight="400" />
<ActionBar DefaultAction="DoubleClick" />
</px:PXGrid>
</asp:Content>
What am I missing ? I spent a few hours on it already and I've ran out of ideas.
Edit:
My end goal is to calculate the sum of the credit and debit for the selected lines on filter view. If you have any workaround to update these values everytime I select a new line, i'll take it.
Maybe with some javascript and a callback command ?
I opened a support ticket on this matter on the acumatica partner center.
Edit 2 :
So, I created my own custom selector :
#region UsrletSel
[PXBool]
[PXUIField(DisplayName = "Lettrer")]
public virtual bool? UsrletSel { get; set; }
public abstract class usrletSel : IBqlField { }
#endregion
Then I hid the base selector in aspx, and to keep the original logic I bound the new selector to the base one :
protected void GLTranR_UsrletSel_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
{
if (e.Row == null) return;
var row = (GLTranR)e.Row;
if(row.GetExtension<GLTranExt>().UsrletSel == true)
{
row.Selected = true;
}
else
{
row.Selected = false;
}
}
I set the property CommitChanges=True in aspx for my new field, but i'm still unable to fire any event on this screen.
do you have any idea ?
Edit 3 :
So I totaly randomly got my checkbox (but also the original selected checkbox) to trigger events. You have to double click on the checkbox. (Which doesnt make any sens.) But I can't really tell my customer "start by double clicking if you want your total to calculates".
At 20s
http://recordit.co/1fzW3eDIO9
Regards,

The final answer was the property "BatchUpdate" was set to "true" on the Grid, which prevents the changes to be commited to the server.
Once you set it to false it works fine :

To my knowledge there's no way to do it.
This is the same issue here:
Checkbox control in a grid is not triggering fieldupdated event
The Selected field appears to have special hardcoded logic tied to it. When you read the Selected value in the BLC graph it doesn't provide the current value displayed on screen. Also the field doesn't fire events like the other fields.
I found only two way to get around this:
Use a field with a different name, if the field name is Selected it won't behave like other fields.
Try to implement all your logic using only DAC Field Attributes. This is very hard to achieve.
I don't have a complete solution for #2 but if all you need is a total this code would be a good start:
// Selected count
[PXUnboundFormula(typeof(Switch<Case<Where<DAC.selected, Equal<True>>, int1>, int0>),
typeof(SumCalc<FilterDAC.selectedCount>))]
protected void DAC_Selected_CacheAttached(PXCache sender)
{
}
[PXProcessButton]
[PXUIField(DisplayName = "Select All")]
protected virtual void selectAll()
{
foreach (DAC doc in Dataview.Select())
{
if (doc.Selected != true)
{
doc.Selected = true;
Dataview.Cache.SetStatus(doc, PXEntryStatus.Updated);
}
}
FilterDAC copy = PXCache<FilterDAC>.CreateCopy(FilterDAC.Current);
PXFormulaAttribute.CalcAggregate<DAC.selected>(Dataview.Cache, copy);
Filter.Update(copy);
}

Related

Acumatica - Grid in PXTabItem on PXSmartPanel Not Appearing on Screen

I have a PXSmartPanel on the Sales Orders form (SO301000) in Acumatica ERP (v21.109.0018). In the PXSmartPanel I have a PXTab with two PXTabItem's. Each tab item has a PXGrid in it.
Whenever the smart panel opens, the grid in the first tab item shows with the correct data. But when I select the other tab item, the grid doesn't show at all (no data, no column names, no toolbar actions). I'm not sure if there's an attribute that I'm missing, but any help would be appreciated.
Here is my ASPX code for the PXSmartPanel. The grid with the ID "GridKitNonStkComponents" is the one that isn't showing:
<px:PXSmartPanel runat="server" ID="KitComponentsPanel" DesignView="Content" AllowResize="true"
AcceptButtonID="KitComponentSaveButton" CancelButtonID="KitComponentCancelButton" LoadOnDemand="true"
CaptionVisible="true" Caption="Kit Component Items" Key="KitComponentsPanel"
AutoRepaint="true" style="position:static;" Height="400px" Width="560px">
<px:PXTab ID="kitCompTab" runat="server" Width="100%" Height="85%">
<Items>
<px:PXTabItem Text="Stock Components">
<Template>
<px:PXGrid runat="server" ID="GridKitStkComponents" Height="100%" Width="100%" SyncPosition="true">
<Levels>
<px:PXGridLevel DataMember="KitStkComponents">
<Columns>
<px:PXGridColumn DataField="CompInventoryID" Width="70" CommitChanges="True" />
<px:PXGridColumn DataField="CompDescription" Width="280" />
<px:PXGridColumn DataField="ComponentQty" />
</Columns>
</px:PXGridLevel>
</Levels>
<ActionBar Position="Top">
<Actions>
<AddNew MenuVisible="True" />
<Save MenuVisible="False" Enabled="False" />
<Search MenuVisible="False" Enabled="False" />
<NoteShow Enabled="False" MenuVisible="False" />
<Refresh MenuVisible="True" />
<Delete MenuVisible="True" />
<AdjustColumns MenuVisible="True" />
<ExportExcel MenuVisible="True" />
</Actions>
<CustomItems>
<px:PXToolBarButton>
<AutoCallBack Command="ResetStkCompsToDefault" Target="ds">
<Behavior CommitChanges="true" />
</AutoCallBack>
</px:PXToolBarButton>
</CustomItems>
</ActionBar>
<AutoSize Enabled="true" />
</px:PXGrid>
</Template>
</px:PXTabItem>
<px:PXTabItem Text="Non-Stock Components" LoadOnDemand="true">
<Template>
<px:PXGrid runat="server" ID="GridKitNonStkComponents" Height="100%" Width="100%" SyncPosition="true">
<Levels>
<px:PXGridLevel DataMember="KitNonStkComponents">
<Columns>
<px:PXGridColumn DataField="CompInventoryID" Width="70" CommitChanges="True" />
<px:PXGridColumn DataField="CompDescription" Width="280" />
<px:PXGridColumn DataField="ComponentQty" />
</Columns>
</px:PXGridLevel>
</Levels>
<ActionBar Position="Top">
<Actions>
<AddNew MenuVisible="True" />
<Save MenuVisible="False" Enabled="False" />
<Search MenuVisible="False" Enabled="False" />
<NoteShow Enabled="False" MenuVisible="False" />
<Refresh MenuVisible="True" />
<Delete MenuVisible="True" />
<AdjustColumns MenuVisible="True" />
<ExportExcel MenuVisible="True" />
</Actions>
<CustomItems>
<px:PXToolBarButton>
<AutoCallBack Command="ResetNonStkCompsToDefault" Target="ds">
<Behavior CommitChanges="true" />
</AutoCallBack>
</px:PXToolBarButton>
</CustomItems>
</ActionBar>
<AutoSize Enabled="true" />
</px:PXGrid>
</Template>
</px:PXTabItem>
</Items>
</px:PXTab>
<px:PXPanel ID="KitComponentButtonPanel" runat="server" SkinID="Buttons">
<px:PXButton ID="KitComponentSaveButton" runat="server" DialogResult="OK" Text="Save" />
<px:PXButton ID="KitComponentCancelButton" runat="server" DialogResult="Cancel" Text="Cancel" />
</px:PXPanel>
</px:PXSmartPanel>
Here is the code for my graph extension (at the moment, the EditKitComponents action just opens the smart panel):
public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{
public static bool IsActive() => true;
#region Selects / Views
public SelectFrom<SOLineKitComponent>.
Where<SOLineKitComponent.soOrderType.IsEqual<SOLine.orderType.FromCurrent>.
And<SOLineKitComponent.soOrderNbr.IsEqual<SOLine.orderNbr.FromCurrent>>.
And<SOLineKitComponent.soLineNbr.IsEqual<SOLine.lineNbr.FromCurrent>>.
And<SOLineKitComponent.kitInventoryID.IsEqual<SOLine.inventoryID.FromCurrent>>.
And<SOLineKitComponent.stkItem.IsEqual<True>>>.View KitStkComponents;
public SelectFrom<SOLineKitComponent>.
Where<SOLineKitComponent.soOrderType.IsEqual<SOLine.orderType.FromCurrent>.
And<SOLineKitComponent.soOrderNbr.IsEqual<SOLine.orderNbr.FromCurrent>>.
And<SOLineKitComponent.soLineNbr.IsEqual<SOLine.lineNbr.FromCurrent>>.
And<SOLineKitComponent.kitInventoryID.IsEqual<SOLine.inventoryID.FromCurrent>>.
And<SOLineKitComponent.stkItem.IsEqual<False>>>.View KitNonStkComponents;
public SelectFrom<SOOrder>.View KitComponentsPanel;
#endregion
#region Actions
public PXAction<SOOrder> EditKitComponents;
[PXButton]
[PXUIField(DisplayName = "Edit Kit Components")]
public virtual void editKitComponents()
{
if(KitComponentsPanel.AskExt() == WebDialogResult.OK)
{
}
}
#endregion
}
Here is what the smart panel looks like when the different tab items are selected:
Tab Item with Grid Showing
Tab Item with Grid Not Showing
You need to set the "LoadOnDemand" to false for the whole PXSmartPanel to have the second tab working.
<px:PXSmartPanel runat="server" ID="KitComponentsPanel"
...
LoadOnDemand="False"
...
>
I would also consider setting LoadOnDemand to false for the second tab.
<px:PXTabItem Text="Non-Stock Components" LoadOnDemand="false">

Use of CSAttributes in new pages

We have a new page where we are looking to use the CS Attributes similarly to how they are used in the Item Class and Non Stock item pages
Item Class: Attribute definition.
Non Stock item page: Attribute implementation.
NOTE: I simplified the page to narrow down any potentially needed attributes in the ASPX.
Based on this, my Attribute definition page has the following elements:
Graph:
#region Datamembers
public PXSelect<MDEquipmentType> EquipmentType;
[PXViewName("Attributes")]
public CSAttributeGroupList<MDEquipmentType, MDEquipment> Mapping;
#endregion
ASPX:
<px:PXTabItem Text="Attributes">
<Template>
<px:PXGrid ID="grid" runat="server" DataSourceID="ds" Height="150px" Style="z-index: 100;
border: 0px;" Width="100%" ActionsPosition="Top" SkinID="Details" MatrixMode="True">
<Levels>
<px:PXGridLevel DataMember="Mapping">
<RowTemplate>
<px:PXSelector CommitChanges="True" ID="edAttributeID" runat="server" DataField="AttributeID" AllowEdit="True" FilterByAllFields="True" />
</RowTemplate>
<Columns>
<px:PXGridColumn DataField="IsActive" AllowNull="False" TextAlign="Center" Type="CheckBox" />
<px:PXGridColumn DataField="AttributeID" Width="81px" AutoCallBack="true" LinkCommand="CRAttribute_ViewDetails" />
<px:PXGridColumn AllowNull="False" DataField="Description" Width="351px" />
<px:PXGridColumn DataField="SortOrder" TextAlign="Right" Width="81px" SortDirection="Ascending" />
<px:PXGridColumn AllowNull="False" DataField="Required" TextAlign="Center" Type="CheckBox" />
<px:PXGridColumn AllowNull="True" DataField="CSAttribute__IsInternal" TextAlign="Center" Type="CheckBox" />
<px:PXGridColumn AllowNull="False" DataField="ControlType" Type="DropDownList" Width="81px" />
<px:PXGridColumn AllowNull="True" DataField="DefaultValue" Width="100px" RenderEditorText="False" />
</Columns>
</px:PXGridLevel>
</Levels>
<AutoSize Enabled="True" MinHeight="150" />
</px:PXGrid>
</Template>
</px:PXTabItem>
Result:
So far so good, all records are persisted in the DB correctly in the table CSAttributeGroup
Now, the problem comes when I try to apply the attributes in the data entry page.
This is the page:
When the Equipment Type is set, the attribute grid does not populate.
Graph definition:
public class MDEquipmentEntry : PXGraph<MDEquipmentEntry, MDEquipment>
{
#region Datamembers
public PXSelect<MDEquipment> Equipment;
public CRAttributeList<MDEquipment> Answers;
ASPX:
<px:PXTabItem Text="Attributes">
<Template>
<px:PXGrid ID="PXGridAnswers" runat="server" Caption="Attributes" DataSourceID="ds" SkinID="Inquire" Width="100%" Height="200px" MatrixMode="True">
<Levels>
<px:PXGridLevel DataMember="Answers">
<Columns>
<px:PXGridColumn DataField="AttributeID" />
<px:PXGridColumn DataField="isRequired" TextAlign="Center" Type="CheckBox" Width="80px"/>
<px:PXGridColumn DataField="Value" Width="300px" AllowShowHide="False" AllowSort="False" />
</Columns>
<Layout FormViewHeight="" />
</px:PXGridLevel>
</Levels>
<AutoSize Enabled="True" MinHeight="200" />
<ActionBar>
<Actions>
<Search Enabled="False" />
</Actions>
</ActionBar>
<Mode AllowAddNew="False" AllowColMoving="False" AllowDelete="False" />
</px:PXGrid>
</Template>
</px:PXTabItem>
In the Nonstock item page the attribute is loaded immediately after inserting the Item Class. So I made sure that the commitChanges attribute was added to my page. Also looked for a FieldUpdated event that could be triggering the insertion but that does not appear to be needed.
What could be missing from my code?
The implementation of CRAttributeList depends on a class ID field being defined somewhere in your class. Upon initialization, CRAttributeList will look for a field in your MDEquipment DAC decorated with the CRAttributesField attribute.
For the InventoryItem DAC, here's how it is defined:
[CRAttributesField(typeof(InventoryItem.itemClassID))]
public virtual string[] Attributes { get; set; }
If system is unable to determine the current class ID, your attributes grid will not be populated with anything.

LinkedCommand & callbackcommand not doing anything

I'm trying to add an hyperlink from a field in a grid in a processing screen pointing to a custom object I made but it seems it doesnt do anything.
When I try to debug and set breakpoints it seems it doesnt even execute the code in my function.
I tried following this : How to create a hyperlink user field
And I tried to follow the example 3.4 in T200 (which is basically the same)
Here's my code :
public PXAction<ARRegister> ViewLettering;
[PXButton]
protected virtual void viewLettering()
{
ARRegister row = LinesPendingLettering.Current;
LELettering letPiece = PXSelect<LELettering,
Where<LELettering.letteringCD,
Equal<Required<LELettering.letteringCD>>>>
.Select(this, row.GetExtension<ARRegisterLeExt>().LettrageCD);
// Create instance of destination graph
LetteringAR graph = PXGraph.CreateInstance<LetteringAR>();
graph.Piece.Current = letPiece;
if (graph.Piece.Current != null)
{
throw new PXRedirectRequiredException(graph, true, Constantes.letteringPiece);
}
else
{
throw new PXException(Constantes.errNotFound);
}
}
#endregion
And the code of my page :
<%# Page Language="C#" MasterPageFile="~/MasterPages/FormDetail.master" AutoEventWireup="true" ValidateRequest="false" CodeFile="LE202001.aspx.cs" Inherits="Page_LE202001" Title="Untitled Page" %>
<%# MasterType VirtualPath="~/MasterPages/FormDetail.master" %>
<asp:Content ID="cont1" ContentPlaceHolderID="phDS" Runat="Server">
<px:PXDataSource ID="ds" runat="server" Visible="True" Width="100%"
TypeName="LE.ProcessAR"
PrimaryView="Filter"
>
<CallbackCommands>
<px:PXDSCallbackCommand Name="ViewLettering" Visible="False" DependOnGrid="grid" /></CallbackCommands>
</px:PXDataSource>
</asp:Content>
<asp:Content ID="cont2" ContentPlaceHolderID="phF" Runat="Server">
<px:PXFormView ID="form" runat="server" DataSourceID="ds" DataMember="Filter" Width="100%" Height="100px" AllowAutoHide="false">
<Template>
<px:PXLayoutRule StartColumn="True" ID="PXLayoutRule1" runat="server" StartRow="False"></px:PXLayoutRule>
<px:PXSelector CommitChanges="True" runat="server" ID="CstPXSelector2" DataField="BranchID" ></px:PXSelector>
<px:PXSelector AutoRefresh="True" CommitChanges="True" runat="server" ID="CstPXSelector1" DataField="AccountID" ></px:PXSelector>
<px:PXLayoutRule runat="server" ID="CstPXLayoutRule5" StartColumn="True" ></px:PXLayoutRule>
<px:PXNumberEdit runat="server" ID="CstPXNumberEdit3" DataField="TotalCredit" ></px:PXNumberEdit>
<px:PXNumberEdit runat="server" ID="CstPXNumberEdit4" DataField="TotalDebit" ></px:PXNumberEdit>
<px:PXLayoutRule runat="server" ID="CstPXLayoutRule6" StartColumn="True" />
<px:PXCheckBox CommitChanges="True" runat="server" ID="CstPXCheckBox7" DataField="ShowAll" ></px:PXCheckBox></Template>
</px:PXFormView>
</asp:Content>
<asp:Content ID="cont3" ContentPlaceHolderID="phG" Runat="Server">
<px:PXGrid SyncPosition="True" AutoAdjustColumns="True" ID="grid" runat="server" DataSourceID="ds" Width="100%" Height="150px" SkinID="Details" AllowAutoHide="false">
<Levels>
<px:PXGridLevel DataMember="LinesPendingLettering">
<Columns>
<px:PXGridColumn Type="CheckBox" AllowFilter="True" AllowCheckAll="True" CommitChanges="True" DataField="Selected" Width="30" ></px:PXGridColumn>
<px:PXGridColumn DataField="DocType" Width="70" ></px:PXGridColumn>
<px:PXGridColumn DataField="RefNbr" Width="70" ></px:PXGridColumn>
<px:PXGridColumn DataField="DocDesc" Width="200" ></px:PXGridColumn>
<px:PXGridColumn DataField="CuryOrigDocAmt" Width="100" ></px:PXGridColumn>
<px:PXGridColumn DataField="CuryID" Width="70" ></px:PXGridColumn>
<px:PXGridColumn LinkCommand="ViewLettering" DataField="LettrageCD" Width="70" ></px:PXGridColumn></Columns>
</px:PXGridLevel>
</Levels>
<AutoSize Container="Window" Enabled="True" MinHeight="150" ></AutoSize>
<ActionBar >
</ActionBar>
</px:PXGrid>
</asp:Content>
The generic type parameter of PXAction has to be the same DAC as the primary view DAC.
The primary view attribute is set on PXDataSource element in the ASPX page:
<px:PXDataSource ID="ds" runat="server" PrimaryView="Filter">
In your graph or graph extension you can locate the primary view DAC:
public PXFilter<DAC> Filter;
Make sure the PXAction declaration is on the same DAC:
public PXAction<DAC> Action;
Adding an observation I had to this older thread, hoping it may help someone:
If you have everything setup as recommended but it is still not working, look carefully at your use of OrderBy in the View's delegate, specifically whether you defined an OrderBy<> directly on its PXSelectBase or used an OrderByNew<> later in
the delegate logic. Using OrderBy<> worked well, but using OrderByNew<> affected the functionality. Details:
The View:
[PXFilterable()]
public PXSelectOrderBy<DAC, OrderBy<Asc<DAC.field1>>> Records;
The Delegate:
protected virtual IEnumerable records()
{
PXSelectBase<DAC> cmd = new PXSelectJoinOrderBy<DAC,
InnerJoin<OtherDAC, On<DAC.field1, Equal<OtherDAC.field1>>>,
OrderBy<Desc<DAC.field1,
Desc<DAC.field2>>>>(this);
...
some filtering logic
...
// defining OrderByNew affected DependOnGrid/LinkCommand functionality
// cmd.OrderByNew<OrderBy<Desc<DAC.field1,
// Desc<DAC.field2>>>>();
foreach(DAC rec in cmd.Select())
yield return rec;
}
I am using 2018R1, Build 18.112.0019.

acumatica _RowInserting events are not triggered when click on 'add row' in the grid

I am have problem with Grid in Checks and Payments screen. When I click on "Add row" button a new row appears in the grid, but not in cache. Events such as APAdjust_RowInserting, APAdjust_RowInserted are not triggered.
Maybe somebody know why this happens?
To trigger a callback to the server as soon as a new row is inserted in a grid, you need to add the tag <Mode InitNewRow="true" />.
Here's an example:
<px:PXGrid ID="grid" runat="server" Height="150px" Width="100%" Caption="Temporary Credit Limit History"
SkinID="Details">
<Levels>
<px:PXGridLevel DataMember="ARTempCreditLimitRecord">
<Columns>
<px:PXGridColumn DataField="CustomerID" TextAlign="Right" Visible="False" />
<px:PXGridColumn DataField="StartDate" Width="90px" AutoCallBack="True" />
<px:PXGridColumn DataField="EndDate" Width="90px" AutoCallBack="True" />
<px:PXGridColumn DataField="TempCreditLimit" TextAlign="Right" Width="100px" />
<px:PXGridColumn DataField="LineID" TextAlign="Right" Visible="False" />
</Columns>
</px:PXGridLevel>
</Levels>
<Mode InitNewRow="True" />
<AutoSize Container="Window" Enabled="True" MinHeight="150" />
</px:PXGrid>

Create preview pane for grid

I want to create a preview pane below my custom grid on a tab, same as in other places it shows a preview below grid when I select any row.
I am using
PXGridWithPreview
And included
PreviewPanelTemplate
But, it is giving me below error
View AcumaticaActivities$Preview doesn't exist
I am not sure if I need to do any settings. Any suggestions?
Try to add PXPreviewAttribute to the selected view.
[PXPreview(typeof(TPrimaryView), typeof(TDacForPreview))]
public PXSelect<TPrimaryView,... AcumaticaActivities;
Here is the sample:
Graph code
public class SOPreview : PXGraph<SOPreview>
{
public PXCancel<SOOrder> Cancel;
[PXFilterable]
[PXPreview(typeof(SOOrder))]
public PXSelectJoin<SOOrder, LeftJoin<SOLine,
On<SOOrder.orderType, Equal<SOLine.orderType>,
And<SOOrder.orderNbr, Equal<SOLine.orderNbr>>>>> Orders;
public PXSelect<SOOrder,
Where<SOOrder.orderType, Equal<Current<SOOrder.orderType>>,
And<SOOrder.orderNbr, Equal<Current<SOOrder.orderNbr>>>>> Orders2;
public PXAction<SOOrder> View;
[PXUIField(DisplayName="View")]
[PXButton]
protected virtual IEnumerable view(PXAdapter a)
{
Orders2.AskExt();
return a.Get();
}
}
ASPX markup
<%# Page Language="C#" MasterPageFile="~/MasterPages/ListView.master" AutoEventWireup="true" ValidateRequest="false" CodeFile="C9101000.aspx.cs" Inherits="Page_C9101000" Title="Untitled Page" %>
<%# MasterType VirtualPath="~/MasterPages/ListView.master" %>
<asp:Content ID="cont1" ContentPlaceHolderID="phDS" runat="Server">
<px:PXDataSource ID="ds" runat="server" Visible="True" Width="100%" PrimaryView="Orders" TypeName="GridWithPreview.SOPreview">
</px:PXDataSource>
<px:PXSmartPanel ID="pnlSODetail" runat="server" Style="z-index: 108;"
Caption="Sales Order Details" CaptionVisible="True"
Key="Orders2" ShowAfterLoad="false"
AutoRepaint="true"
AcceptButtonID="PXButtonOK">
<px:PXFormView ID="frmSO" runat="server" DataSourceID="ds" DataMember="Orders2" Width="100%"
Style="z-index: 100" TabIndex="17100">
<Template>
<px:PXLayoutRule runat="server" StartRow="True">
</px:PXLayoutRule>
<px:PXTextEdit ID="PXTextEdit1" runat="server" DataField="OrderType" Enabled="false">
</px:PXTextEdit>
<px:PXTextEdit ID="PXTextEdit2" runat="server" DataField="OrderNbr" Enabled="false">
</px:PXTextEdit>
<px:PXTextEdit ID="PXTextEdit3" runat="server" DataField="CustomerID" Enabled="false">
</px:PXTextEdit>
<px:PXTextEdit ID="PXTextEdit4" runat="server" DataField="OrderDesc" Enabled="false">
</px:PXTextEdit>
</Template>
</px:PXFormView>
<px:PXPanel ID="PXPanel1" runat="server" SkinID="Buttons">
<px:PXButton ID="pxBtnOK" runat="server" DialogResult="OK" Text="Close" />
</px:PXPanel>
</px:PXSmartPanel>
</asp:Content>
<asp:Content ID="cont2" ContentPlaceHolderID="phL" runat="Server">
<pxa:PXGridWithPreview ID="grid" runat="server" Height="400px" Width="100%" Style="z-index: 100"
AllowPaging="True" AllowSearch="True" DataSourceID="ds" TabIndex="100"
GridSkinID="Inquire"
PreviewPanelStyle="z-index: 100; background-color: Window"
PreviewPanelSkinID="Preview">
<Levels>
<px:PXGridLevel DataKeyNames="OrderType,OrderNbr" DataMember="Orders">
<Columns>
<px:PXGridColumn DataField="OrderType">
</px:PXGridColumn>
<px:PXGridColumn DataField="OrderNbr">
</px:PXGridColumn>
<px:PXGridColumn DataField="CustomerID" Width="120px">
</px:PXGridColumn>
<px:PXGridColumn DataField="OrderDate" Width="90px">
</px:PXGridColumn>
<px:PXGridColumn DataField="Status">
</px:PXGridColumn>
<px:PXGridColumn DataField="OrderDesc" Width="200px">
</px:PXGridColumn>
</Columns>
</px:PXGridLevel>
</Levels>
<AutoSize Container="Window" Enabled="True" MinHeight="200" />
<PreviewPanelTemplate>
<px:PXHtmlView ID="edPreviewCtrl" runat="server" DataField="OrderDesc" TextMode="MultiLine" MaxLength="50" Width="100%" Height="100px" SkinID="Label">
<AutoSize Container="Parent" Enabled="true"></AutoSize>
</px:PXHtmlView>
</PreviewPanelTemplate>
<GridMode AllowAddNew="False" AllowDelete="False" />
</pxa:PXGridWithPreview>
</asp:Content>

Resources