I have a problem in Modern UI.
In Classic UI I have 2 grids inside SmartPanel:
-
Top grid: BZItemQuantityInq
-
Bottom grid: BZItemLotInq
When I click any row in the top grid, the bottom grid refreshes automatically and shows related data. Everything works fine there.
<px:PXSmartPanel runat="server" ID="CstSmartPanel1" Caption="Item Quantity Inquiry" CaptionVisible="True" LoadOnDemand="True" Width="1100px" Key="BZItemQuantityInq" AutoRepaint="True" AutoReload="True" ShowAfterLoad="True" CancelButtonID="CstButton8" CloseButtonDialogResult="No">
<px:PXGrid runat="server" ID="CstPXGrid2" AdjustPageSize="None" AllowPaging="True" SkinID="Details" Width="100%" DataSourceID="ds" SyncPosition="True" KeepPosition="True">
<Levels>
<px:PXGridLevel DataMember="BZItemQuantityInq">
<Columns>
......
</Columns></px:PXGridLevel></Levels>
<AutoSize Enabled="True" />
<AutoCallBack Enabled="True" Command="Refresh" Target="CstPXGrid3" />
<ClientEvents AfterRowInsert="" /></px:PXGrid>
<px:PXGrid runat="server" ID="CstPXGrid3" AdjustPageSize="None" AllowPaging="True" SkinID="Details" Width="100%" SyncPosition="True" DataSourceID="ds" MatrixMode="True" RepaintColumns="True" AutoAdjustColumns="True">
<Levels>
<px:PXGridLevel DataMember="BZItemLotInq">
<Columns>
......
</Columns></px:PXGridLevel></Levels>
<AutoSize Enabled="True" />
<ClientEvents AfterRowFormOpen="customizeGridRowColor()" /></px:PXGrid>
<px:PXPanel runat="server" ID="CstPanel7" SkinID="Buttons">
<px:PXButton runat="server" ID="CstButton8" Text="Load" DependOnGrid="grid" Target="ds" AlignLeft="False" DialogResult="OK" StateColumn="UsrBZAllowLoadBtn">
<AutoCallBack Command="BZLoad" Target="ds" /></px:PXButton>
<px:PXButton runat="server" ID="CstButton9" Text="Delete allocated lines" AlignLeft="False" DependOnGrid="grid" StateColumn="UsrBZAllowDeleteBtn" Target="ds">
<AutoCallBack Command="BZDeleteAllocate" Target="ds" /></px:PXButton>
<px:PXJavaScript runat="server" ID="CstJavaScript11" Script="function customizeGridRowColor() { const gridName = "CstPXGrid3"; const targetFieldName = "UsedLot"; const gridInstance = px_all["ctl00_phG_CstSmartPanel1_CstPXGrid3"]; if (!gridInstance) { console.warn(`Grid ${gridName} not found.`); return; } let lines = gridInstance.rows.items; for(let i=0;i<lines.length;i++) { let currentLine=lines[i]; if(currentLine.getCell(targetFieldName).getValue() === true) { currentLine.style = 'background-color: yellow'; currentLine.repaint(); } } } setInterval(customizeGridRowColor, 100);" /></px:PXPanel></px:PXSmartPanel>
Here is my MUI Files:
@gridConfig({
preset: GridPreset.Details,
syncPosition: true,
keepPosition: true,
adjustPageSize: false,
showFastFilter: GridFastFilterVisibility.False,
autoRepaint: ["BZSOLineLotQuantityInq"]
})
export class BZSOLineQuantityInq extends PXView {
...
}
@gridConfig({
preset: GridPreset.Details,
syncPosition: true,
keepPosition: true,
repaintColumns: true,
autoAdjustColumns: true,
adjustPageSize: false,
showFastFilter: GridFastFilterVisibility.False,
})
export class BZSOLineLotQuantityInq extends PXView {
...
}
<qp-panel id="BZItemQuantityInq" caption="Item Quantity Inquiry" auto-repaint="true">
<qp-grid id="grid-BZItemQuantityInq" view.bind="BZItemQuantityInq"></qp-grid>
<qp-grid id="grid-BZItemLotInq" view.bind="BZItemLotInq"></qp-grid>
<footer>
<qp-button id="btnOKLoad" dialog-result="OK" caption="Load" state.bind="BZLoad"></qp-button>
<qp-button id="btnDeleteAllocatedLines" caption="Delete allocated lines" state.bind="BZDeleteAllocate"></qp-button>
</footer>
</qp-panel>When I select a row in the top grid, the bottom grid does NOT refresh.
I already tried using syncPosition, keepPosition, autoRepaint but still not working.
Also, in Classic UI buttons enabled/disabled conditionally, but in Modern UI both buttons are always enabled.
So the question is: how to correctly implement this behavior in Modern UI both refreshing the second grid based on selected row in the first grid and making buttons conditionally enabled/disabled?