2017-01-09 14 views
0

表示されているアイテムと同じアイテムクラスのすべてのアイテムを表示するビューを[在庫アイテム]ページに作成しました。ビューは正しく表示されますが、現在のプロパティーが正しくありません。なんらかの理由で、relatedItems.Currentレコードは常にグリッド内で選択されているアイテムではなく、ページ上の現在のアイテムです。カスタムビューの現在のプロパティが正しく更新されない

私はASPXページでコールバック関数を持ち、InventoryCDこの関数を呼び出すLinkCommandを持っています。奇妙なのは、Item Classes画面で同じコードを使用していて、完全に機能することです。

私のカスタムビューのCurrentプロパティは、常にクリックされたレコードです。グリッドのSyncPosition設定がtrueに設定されています。 InventoryItemInventoryItemを参照しているため、問題が発生する可能性がありますか?ページにあなたの行動のためのDependOnGridプロパティを指定した場合のおかげで

public class InventoryItemMaint_Extension : PXGraphExtension<InventoryItemMaint> 
{ 

    #region Event Handlers 

    public PXSelectReadonly<InventoryItem, Where<InventoryItem.itemClassID, Equal<Current<InventoryItem.itemClassID>>, And<InventoryItem.inventoryID, NotEqual<Current<InventoryItem.inventoryID>>>>> relatedItems; 

    public PXAction<InventoryItem> ViewCurrentItem; 

    [PXButton] 
    protected virtual void viewCurrentItem() 
    { 

     InventoryItem row = relatedItems.Current; 

     // Create the instance of the destination graph 
     InventoryItemMaint graph = PXGraph.CreateInstance<InventoryItemMaint>(); 
     graph.Item.Current = row; 

     if (graph.Item.Current != null) 
     { 
      throw new PXRedirectRequiredException(graph, true, "Item"); 
     } 
    } 
} 

答えて

0

確認してください: -

<CallbackCommands> 
    ... 
    <px:PXDSCallbackCommand Name="ViewCurrentItem" Visible="true" DependOnGrid="RelatedGridID" /> 
</CallbackCommands> 

プロパティT200トレーニング材料で説明されて

代替オプションが希望

enter image description here

PXSelectorのAllowEditを利用することになります。カスタムアクションは必要ありません。

<px:PXGrid … > 
    <Levels> 
     <px:PXGridLevel …> 
     <Columns> 
     … 
     </Columns> 
     <RowTemplate> 
      <px:PXSegmentMask runat="server" ID="CstPXSegmentMask2" DataField="InventoryCD" AllowEdit="True" />            
     </RowTemplate> 
     </px:PXGridLevel> 
    </Levels> 
</px:PXGrid> 

同じページ内の項目を変更するには、

あなたが同じデータレコードを表示する場合を除き、各データビューは、固有の主要なデータアクセスクラス(DAC)を参照してください複数のコンテナコントロール。これで、InventoryItemから継承した関連アイテムを表す新しいDACを作成し、BQLステートメントで使用される派生クラスのデータフィールドの新しい抽象クラスの定義を作成する必要があります。

[Serializable] 
public class RelatedInventoryItem : InventoryItem 
{ 
    public new abstract class inventoryID : IBqlField { }; 

    public new abstract class itemClassID : IBqlField { }; 
} 

そして、あなたのデータビューは

public PXSelectReadonly<RelatedInventoryItem, 
         Where<RelatedInventoryItem.itemClassID, 
           Equal<Current<InventoryItem.itemClassID>>, 
          And<RelatedInventoryItem.inventoryID, 
          NotEqual<Current<InventoryItem.inventoryID>>>>> 
         relatedItems; 
0

あるべき@DChhapgarはい、私はDependOnGridが正しく設定されています。ここに関連するコードのすべてです:

<px:PXDSCallbackCommand Name="ViewRelatedItems" Visible="true" DependOnGrid="relatedItemsGridID" /></CallbackCommands> 
.... 
    <px:PXTabItem Text="Related Items"> 
    <Template> 
     <px:PXGrid runat="server" ID="relatedItemsGridID" SkinID="DetailsInTab" Width="100%" SyncPosition="True" DataSourceID="ds" > 
      <Levels> 
       <px:PXGridLevel DataMember="relatedItems"> 
        <Columns> 
         <px:PXGridColumn DataField="InventoryCD" Width="100" LinkCommand="ViewRelatedItems"/> 
         <px:PXGridColumn DataField="InventoryID" Width="100" /> 
         <px:PXGridColumn DataField="ItemClassID" Width="100" /> 
         <px:PXGridColumn DataField="Descr" Width="200" /> 
         <px:PXGridColumn DataField="ItemStatus" Width="100" /> 
         <px:PXGridColumn DataField="ItemType" Width="100" /> 
         <px:PXGridColumn DataField="KitItem" Width="60" /></Columns> 
        </px:PXGridLevel></Levels> 
      <AutoSize Enabled="True" MinHeight="200" /> 
      <Mode AllowAddNew="False" AllowDelete="False" AllowUpdate="False" /></px:PXGrid></Template></px:PXTabItem> 
.... 

AllowEditPXSelectorの作品を使用して、私はとても理想的なユーザーが項目をクリックします、同じページ内の項目を変更したい、在庫のID /インベントリCDフィールドには、クリックされたItemが挿入され、変更がコミットされます。

+0

元の回答を更新しました。 – DChhapgar

関連する問題