Search code examples
acumatica

How do I make a grid in a smart panel refresh based on the current row of my child grid on the page?


I have a standard form tab screen with a grid on the first tab. The form identifies a tool by inventory id. The grid identifies the individual tools of that id that are available for use. Since the tool can be checked out and returned, much like the old video rental stores would rent DVD's and VHS tapes, I need to see a history of where the tool has been. Typically, there are only a few tools per inventory id. However, checkout history can be rather lengthy. I want to show that history in a smart panel, but I can't get the smart panel to update as I change rows of the grid, selecting different physical units.

How do I get the smart panel grid to refresh based on the main screen's current grid row?

The button on my action bar of the grid is defined as:

<px:PXToolBarButton Text="History" DependOnGrid="CstPXGrid7" >
    <AutoCallBack Command="viewHistory" Target="ds" >
        <Behavior PostData="Page" CommitChanges="True" ></Behavior>
    </AutoCallBack>
</px:PXToolBarButton>

The smart panel is defined as:

<px:PXSmartPanel
    runat="server"
    ID="PnlSSCSHistory"
    CommandSourceID="ds"
    Caption="History"
    CaptionVisible="True"
    Height="400px"
    Width="800px"
    LoadOnDemand="true"
    Key="History"
    >

<px:PXGrid AllowPaging="True" Width="100%" DataSourceID="ds" SkinID="Inquire" runat="server" ID="CstPXGrid34">
    <Levels>
        <px:PXGridLevel DataMember="History" >
            <Columns>
                <px:PXGridColumn DataField="ToolNbr" Width="140" ></px:PXGridColumn>
                <px:PXGridColumn DataField="RequesterID" Width="70" ></px:PXGridColumn>
                <px:PXGridColumn DataField="CustomerLocationID" Width="70" ></px:PXGridColumn>
                <px:PXGridColumn DataField="DateOut" Width="90" ></px:PXGridColumn>
                <px:PXGridColumn DataField="DateDue" Width="90" ></px:PXGridColumn>
                <px:PXGridColumn DataField="DateIn" Width="90" ></px:PXGridColumn>
            </Columns>
        </px:PXGridLevel>
    </Levels>
    <AutoSize Enabled="True" ></AutoSize>
</px:PXGrid>
<px:PXPanel runat="server" ID="CstPanelSSCS3" SkinID="Buttons">
    <px:PXButton runat="server" ID="CstHistory" DialogResult="OK" Text="OK" CommandSourceID="ds" ></px:PXButton>
</px:PXPanel>
</px:PXSmartPanel>

As you can see in the screenshot, tool #2 is selected, but the history in the smart panel is still showing for tool #1. However, as a temporary measure, I added a secondary grid to the main page, and it is showing the history for the correct tool by adding the following to my main grid that lists each tool number. My temporary history grid on the main page is CstPXGrid38. Adding the smart panel's Control ID here does not update the smart panel's grid the same way it does the history grid when on the main screen.

<AutoCallBack Command="Refresh" Target="CstPXGrid38" ActiveBehavior="true">
    <Behavior RepaintControlsIDs="CstPXGrid38" ></Behavior>    
</AutoCallBack>

Screenshot


Solution

  • The generic declaration of the PXSmarPanel to accomplish the desired functionality should be as follows :

    <px:PXSmartPanel ID="GridPanel" runat="server" Height="550px" Width="873px" Caption="My Fancy Grid refresh panel" CaptionVisible="True" Key="GridPanelView" AutoCallBack-Command="Refresh" AutoCallBack-Target="gridPanel" CreateOnDemand="True">
    

    Where "gridPanel" is the ID of your panels grid.