I want to show a book mark history notes fetch from API call in customer screen (AR303000)
I added the below grid
<px:PXButton runat="server" ID="btnBookMarkHistory" Text="Book Mark History"><AutoCallBack Command="BookMarkHistory" Target="ds" /></px:PXButton>
<px:PXGrid ID="PXGrid2" runat="server" DataSourceID="ds">
<Levels>
<px:PXGridLevel DataMember="BookMarkHistoryView">
<Mode AllowAddNew="False" AllowDelete="False" AllowUpdate="False" />
<Columns>
<px:PXGridColumn DataField="Type" TextAlign="Left" />
<px:PXGridColumn DataField="ShortNotes" TextAlign="Left" />
</Columns>
</px:PXGridLevel>
</Levels>
</px:PXGrid>
And my DAC is
[Serializable]
[PXCacheName("BookMarkHistory")]
public class BookMarkHistory : PXBqlTable, IBqlTable
{
#region Type
[PXString(10, IsUnicode = true)]
[PXUIField(DisplayName = "Type")]
public virtual string Type { get; set; }
public abstract class type : PX.Data.BQL.BqlString.Field<type> { }
#endregion
#region ShortNotes
[PXString(500, IsUnicode = true)]
[PXUIField(DisplayName = "Short Notes")]
public virtual string ShortNotes { get; set; }
public abstract class shortNotes : PX.Data.BQL.BqlString.Field<shortNotes> { }
#endregion
}
my graph is
public class CustomerMaintExt : PXGraphExtension<CustomerMaint>
{
public PXFilter<BookMarkHistory> BookMarkHistoryView;
public PXAction<Customer> BookMarkHistory;
[PXButton]
[PXUIField(DisplayName = "BookMark History")]
protected virtual IEnumerable bookMarkHistory(PXAdapter adapter)
{
BLBookmarkhistory bLBookmarkhistory = new BLBookmarkhistory();
List<BookMarkHistory> lstResult = bLBookmarkhistory.getBookmarkHistory();
if (lstResult.Count > 0)
{
BookMarkHistoryView.Cache.Clear();
foreach (var result in lstResult)
{
BookMarkHistoryView.Cache.Insert(result);
}
}
return adapter.Get();
}
}
The problem is there should have 5 rows in the grid but it shows only one data. The first data only .I have debugged my code and found foreach (var result in lstResult) this loops 5 times and the correct data is in insert BookMarkHistoryView.Cache.Insert(result); But still only first data in the Grid .
Why and how to solve ? any help would be appreciated