Hello!
I’ve made some modifications to the Inventory Lookup smart panel in the Sales Order Screen.
I added a new grid with a Split panel like this:
The left grid shows the available attributes for the selected ItemClassID so that the users can search inventory items by it’s attributes.
The “Search” button on the top of the attributes Grid, goes through the filtered Item list and gets the list of items that matches the user’s attribute selection.
The problem is that I can’t update the right grid with the list of items.
The Callbackcommand in the aspx is the following:
<px:PXDSCallbackCommand Name="AttributeSearch" DependOnGrid="Attributes" Visible="False" />
The button:
<ActionBar>
<CustomItems>
<px:PXToolBarButton Text="Search" CommandName="AttributeSearch" DependOnGrid="Attributes" Visible="">
<AutoCallBack Command="AttributeSearch" Target="ds" />
</px:PXToolBarButton>
</CustomItems>
</ActionBar>
In the graph I try to clear the grid cache, loop though the item list and insert the filtered data:
//Getting the list of items
var filteredProducts = ItemResults.Select().RowCast<SOSiteStatusSelected>().ToList();
//Getting the attributes
var AttributesFilter = Attributes.Select().RowCast<USRCBItemSearchAttributes>().ToList();
if (filteredProducts.Count > 0)
{
// Trying to clear the results grid
ItemResults.Cache.Clear();
List<string> attVals = new List<string>();
foreach (USRCBItemSearchAttributes attOpt in AttributesFilter)
{
if(attOpt.AttValue != null)
{
attVals.Add(attOpt.AttValue);
}
}
int attFilterSize = attVals.Count;
foreach (SOSiteStatusSelected product in filteredProducts)
{
SOSiteStatusSelectedExtension selExt = PXCache<SOSiteStatusSelected>.GetExtension<SOSiteStatusSelectedExtension>(product);
if (selExt.ItemAttributes != null)
{
int coincidence = 0;
foreach(string vals in attVals)
{
bool containsVal = selExt.ItemAttributes.Contains(vals);
if (containsVal)
{
coincidence++;
}
}
if(attFilterSize == coincidence)
{
ItemResults.Insert(product);
}
}
}
ItemResults.View.RequestRefresh();
}
Hope someone can help me find what’s missing.