Acumatica - creating a simple detail screen with header - acumatica

Acumatica is seriously gonna make me cry. I have followed the tutorial in T100 to create a simple inquiry screen. When I open it, the screen is blank. I can see the layout in design view, when I load the screen it is blank.
My graph:
public class QLInventoryMaint : PXGraph<QLInventoryMaint>
{
public QLInventoryMaint()
{
ResponseRec.Cache.AllowInsert = false;
ResponseRec.Cache.AllowDelete = false;
ResponseRec.Cache.AllowUpdate = false;
}
[Serializable]
public class StrainFilter : IBqlTable
{
#region DisplayID
public abstract class displayID : PX.Data.IBqlField
{
}
protected String _DisplayID;
[PXString(4)]
[PXUIField(DisplayName = "Display ID")]
public virtual String DisplayID
{
get
{
return this._DisplayID;
}
set
{
this._DisplayID = value;
}
}
#endregion
}
public PXCancel<StrainFilter> Cancel;
public PXFilter<StrainFilter> StrainFilterRec;
[PXFilterable]
public PXSelectReadonly<StrainResult, Where<StrainResult.displayID, Equal<Current<StrainFilter.displayID>>>> ResponseRec;
}
My page:
<%# Page Language="C#" MasterPageFile="~/MasterPages/FormDetail.master" AutoEventWireup="true" ValidateRequest="false" CodeFile="SO301010.aspx.cs" Inherits="Page_SO301010" 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%" PrimaryView="StrainFilterRec" TypeName="PX.Objects.SO.QLInventoryMaint">
</px:PXDataSource>
</asp:Content>
<asp:Content ID="cont2" ContentPlaceHolderID="phF" Runat="Server">
<px:PXFormView ID="form" runat="server" DataSourceID="ds" Style="z-index: 100"
Width="100%" DataMember="StrainFilterRec" TabIndex="2500">
<Template>
<px:PXLayoutRule runat="server" StartRow="True"/>
<px:PXTextEdit ID="edDisplayID" runat="server" AlreadyLocalized="False" DataField="DisplayID" DefaultLocale="">
</px:PXTextEdit>
</Template>
</px:PXFormView>
</asp:Content>
<asp:Content ID="cont3" ContentPlaceHolderID="phG" Runat="Server">
<px:PXGrid ID="grid" runat="server" DataSourceID="ds" Style="z-index: 100"
Width="100%" Height="150px" SkinID="Details" TabIndex="3500" TemporaryFilterCaption="Filter Applied">
<EmptyMsg ComboAddMessage="No records found.
Try to change filter or modify parameters above to see records here." NamedComboMessage="No records found as '{0}'.
Try to change filter or modify parameters above to see records here." NamedComboAddMessage="No records found as '{0}'.
Try to change filter or modify parameters above to see records here." FilteredMessage="No records found.
Try to change filter to see records here." FilteredAddMessage="No records found.
Try to change filter to see records here." NamedFilteredMessage="No records found as '{0}'.
Try to change filter to see records here." NamedFilteredAddMessage="No records found as '{0}'.
Try to change filter to see records here." AnonFilteredMessage="No records found.
Try to change filter to see records here." AnonFilteredAddMessage="No records found.
Try to change filter to see records here."></EmptyMsg>
<Levels>
<px:PXGridLevel DataKeyNames="DisplayID" DataMember="ResponseRec">
<Columns>
<px:PXGridColumn DataField="Name" Width="200px">
</px:PXGridColumn>
<px:PXGridColumn DataField="Abbreviation">
</px:PXGridColumn>
<px:PXGridColumn DataField="ClonesCount" TextAlign="Right">
</px:PXGridColumn>
<px:PXGridColumn DataField="PlantsCount" TextAlign="Right">
</px:PXGridColumn>
<px:PXGridColumn DataField="HarvestedCount" TextAlign="Right">
</px:PXGridColumn>
<px:PXGridColumn DataField="WetFlowerWeight" TextAlign="Right">
</px:PXGridColumn>
<px:PXGridColumn DataField="DryFlowerWeight" TextAlign="Right">
</px:PXGridColumn>
</Columns>
</px:PXGridLevel>
</Levels>
<AutoSize Container="Window" Enabled="True" MinHeight="150" />
</px:PXGrid>
</asp:Content>
I wanted originally to create a lookup screen with no database fields, but I was getting the same result. I decided just o follow tutorial and create inquiry screen. I hate this framework.

My guess is the Current<> display ID is not getting set so the query for the grid is empty. You can do a SQL trace to confirm but I would use CommitChange="True" on the filter field in your page...
<px:PXTextEdit ID="edDisplayID" runat="server" AlreadyLocalized="False" DataField="DisplayID" CommitChanges="True">

It appears that FormDetail creation does not work in 17.204.0019. I created the screen in 17.202.0016 and it worked fine. I imported the screen into 17.204.0019 and it also worked. Can anyone confirm or deny this?

Related

INTran Not showing LotNumberNbr

Good day
I have made a new Grid to show data from INTran(PX.Objects.IN.INTran)
I see there is a LotSerialNbr in the INTran DAC. But when I make a new PXSelect I don't see it in the "ADD DATA FIELDS" on my page.
I add the Lot/Serial Nbr(LotSerialNbr) when loading stock on the Inventory Receipts.
I have also checked INRegister and INTranSplit both not show the Lot Serial Nbr?
using System;
using PX.Data;
using PX.Objects.IN;
using PX.Objects.SO;
namespace Test
{
public class StockTransfer : PXGraph<StockTransfer>
{
public PXSave<MasterTable> Save;
public PXCancel<MasterTable> Cancel;
public PXFilter<MasterTable > MasterView;
public PXFilter<INTran> DetailsView;
[Serializable]
public class MasterTable : IBqlTable
{
}
[Serializable]
public class DetailsTable : IBqlTable
{
}
public PXSelect<INRegister> Register;
public PXSelect<INTran> INTran;
public PXSelect<INTranSplit > INTranSplit ;
}
}
How can I get the Lot Serial number to show on the grid?
edit here is the ASPX:
<%# Page Language="C#" MasterPageFile="~/MasterPages/FormDetail.master" AutoEventWireup="true" ValidateRequest="false" CodeFile="ABIT1111.aspx.cs" Inherits="Page_ABIT1111" 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="JVDLocationTransfer.TransferGrap"
PrimaryView="MasterView"
>
<CallbackCommands>
</CallbackCommands>
</px:PXDataSource>
</asp:Content>
<asp:Content ID="cont2" ContentPlaceHolderID="phF" Runat="Server">
<px:PXFormView ID="form" runat="server" DataSourceID="ds" DataMember="MasterView" Width="100%" Height="100px" AllowAutoHide="false">
<Template>
<px:PXLayoutRule ID="PXLayoutRule1" runat="server" StartRow="True"></px:PXLayoutRule>
<px:PXTextEdit runat="server" ID="CstPXTextEdit1" DataField="UsrFROMLocation" />
<px:PXTextEdit runat="server" ID="CstPXTextEdit2" DataField="UsrInventoryID" />
<px:PXTextEdit runat="server" ID="CstPXTextEdit3" DataField="UsrInventoryItemDescription" />
<px:PXTextEdit runat="server" ID="CstPXTextEdit4" DataField="UsrQty" />
<px:PXTextEdit runat="server" ID="CstPXTextEdit5" DataField="UsrReasonCode" />
<px:PXTextEdit runat="server" ID="CstPXTextEdit6" DataField="UsrSKU" />
<px:PXTextEdit runat="server" ID="CstPXTextEdit7" DataField="UsrUOM" /></Template>
</px:PXFormView>
</asp:Content>
<asp:Content ID="cont3" ContentPlaceHolderID="phG" Runat="Server">
<px:PXGrid ID="grid" runat="server" DataSourceID="ds" Width="100%" Height="150px" SkinID="Details" AllowAutoHide="false">
<Levels>
<px:PXGridLevel DataMember="INTran">
<Columns>
<px:PXGridColumn DataField="InventoryID" Width="70" />
<px:PXGridColumn DataField="LotSerialNbr" ></px:PXGridColumn></Columns>
</px:PXGridLevel>
</Levels>
<AutoSize Container="Window" Enabled="True" MinHeight="150" />
<ActionBar >
</ActionBar>
</px:PXGrid>
</asp:Content>
The screen graph JVDLocationTransfer.TransferGrap declared in ASPX doesn't match the target StockTransfer graph. Also inexistent columns are declared on dataview like MasterView which points to empty DACs like MasterTable. Wizards functionality such as Add Data Field won't work properly in that context.

unable to fire the fieldupdated or rowupdated event on GL404000 screen

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);
}

How to create Master-Detail Grids in Acumatica?

I'm working on a custom page to visualize the relations between parent and child records by displaying the table data in a hierarchical order.
There are 2 data views in my BLC, which I'd like to use as the data source for two PXGrids to display the data in a master/detail format. When a record is selected in the master grid, all of the related child entries should be shown in the details grid.
How should I declare my 2 PXGrids in Aspx to accomplish this task?
For example, if some BLC contains a Categories data view and a Related Products data view, you would specify the Categories view to be the data source for the master grid and the Products view to be the data source for the details grid. When a category is selected in the master grid, all products associated with that category will be displayed in the details grid from the Products data view.
public class ProductCategories : PXGraph<ProductCategories>
{
#region Actions
public PXSave<Category> Save;
public PXCancel<Category> Cancel;
#endregion
#region Data Members
public PXSelect<Category> Categories;
public PXSelect<CategoryProduct,
Where<CategoryProduct.categoryID,
Equal<Current<Category.categoryID>>>> CategoryProducts;
#endregion
#region Event Handlers
protected virtual void Category_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
this.CategoryProducts.Cache.AllowInsert = e.Row != null;
}
#endregion
}
As shown in the code snippet above, the detail view is referenced with the master view via a Current BQL operator. Also, notice RowSelected event handler defined for the Category DAC to disable Insert button on the details grid if there is not a single record in the master grid.
The next step is to configure master-detail PXGrids in Aspx:
for the master grid set SyncPosition property to true, then define the AutoCallBack and OnChangeCommand properties as follows to accordingly refresh the detail grid every time a different record or no record at all will be selected in the master grid:
<px:PXGrid ID="masterGrid" runat="server" DataSourceID="ds" SkinID="Details"
SyncPosition="True" Caption="Categories" CaptionVisible="True" Width="100%">
<AutoCallBack Command="Refresh" Target="detailGrid" />
<OnChangeCommand Command="Refresh" Target="detailGrid" />
...
</px:PXGrid>
for the detail grid it's only required to define a Refresh CallbackCommand to force the master grid to select data along with the details grid. By doing the framework will raise the previously defined Category_RowSelected event handler and disable Insert button on the details grid in cases when there is no record in the master grid:
<px:PXGrid ID="detailGrid" runat="server" DataSourceID="ds" SkinID="Details"
Caption="Products" CaptionVisible="True" Width="100%">
<CallbackCommands>
<Refresh SelectControlsIDs="masterGrid" />
</CallbackCommands>
...
</px:PXGrid>
For the sake of better user experience, it's recommended to place master-detail PXGrids within a PXSplitContainer as shown in the code snippet below:
<px:PXSplitContainer runat="server" ID="sp" PositionInPercent="true" SplitterPosition="50"
SkinID="Horizontal" Orientation="Horizontal" Panel1MinSize="250" Panel2MinSize="250">
<AutoSize Enabled="true" Container="Window" />
<Template1>
<px:PXGrid ID="masterGrid" runat="server" DataSourceID="ds" SkinID="Details"
SyncPosition="True" Caption="Categories" CaptionVisible="True" Width="100%">
<AutoCallBack Command="Refresh" Target="detailGrid" />
<OnChangeCommand Command="Refresh" Target="detailGrid" />
<Levels>
<px:PXGridLevel DataMember="Categories">
<Columns>
...
</Columns>
</px:PXGridLevel>
</Levels>
<AutoSize Enabled="True" />
</px:PXGrid>
</Template1>
<Template2>
<px:PXGrid ID="detailGrid" runat="server" DataSourceID="ds" SkinID="Details"
Caption="Products" CaptionVisible="True" Width="100%">
<CallbackCommands>
<Refresh SelectControlsIDs="masterGrid" />
</CallbackCommands>
<Levels>
<px:PXGridLevel DataMember="CategoryProducts">
<Columns>
...
</Columns>
</px:PXGridLevel>
</Levels>
<AutoSize Enabled="True" />
</px:PXGrid>
</Template2>
</px:PXSplitContainer>
And here is how master-details PXGrids should look and operate inside an Acumatica webpage:

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.

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