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.
Related
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.
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);
}
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.
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?
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>