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?