Hello,
I’ve added 2 new buttons to a custom grid. An up arrow and a down arrow. I would like to be able to move row items up and down the grid. The sequence controls the order in which the sites/warehouses are checked in my code.
![](https://uploads-us-west-2.insided.com/acumatica-en/attachment/879e3dbf-43b2-498b-8e79-42a37b787cb5.png)
A screen shot is above. The arrows button are highlighted. I have a field called ‘OrderNumber’ which stores the sequence of the items.
The RETAIL site is selected in the grid and I will press the Up Arrow button. ..
![](https://uploads-us-west-2.insided.com/acumatica-en/attachment/8959b862-0121-4301-a942-4f5d9e610e55.png)
After pressing the up arrow button, my code has changed the values in the Order Number field, and the Save button is now available. But the grid has not been refreshed. If I click on the refresh button nothing happens. If I click on the Save button….
![](https://uploads-us-west-2.insided.com/acumatica-en/attachment/fc34cf50-6092-4174-95ef-a6e920892f30.png)
...the page and data is refreshed and the grid is reordered.
The view which provides data to the grid looks like this
public SelectFrom<PinnSitePriority> .Where<PinnSitePriority.siteid.IsEqual<INSite.siteID.FromCurrent>>.OrderBy<PinnSitePriority.orderNumber.Asc>
.View viewPinnSitePriority;
private void MoveRowByArrow(bool moveUp)
{
SequencingRows = true;
PinnSitePriority pinnSitePriority = viewPinnSitePriority.Current;
if (moveUp == true)
{
List<PinnSitePriority> l = viewPinnSitePriority.Cache.Cached.RowCast<PinnSitePriority>().ToList();
//code to reorder the items in the list - not shown to save space
//code to update the items in the cache
int? origNo = pinnSitePriority.OrderNumber;
pinnSitePriority.OrderNumber = p.OrderNumber;
p.OrderNumber = origNo;
//code to update the cache
viewPinnSitePriority.Cache.Update(pinnSitePriority);
viewPinnSitePriority.Cache.Update(p);
//attempts to refresh the grid
viewPinnSitePriority.Select();
viewPinnSitePriority.View.RequestRefresh();
}
else
{// moveDown code}
}
The code above is fired from the up/down action buttons. The idea is to change the numbers in the OrderNumber fields, update the cache and then update the grid with the results. I had hoped that calling RequestRefresh would refresh the view, including the OrderBy section but this doesn’t seem to be the case.
Does anyone know how I can force the grid to update to reflect the updated ordering of the items in the cache.
Thanks
Steve