Она начинается с первой записи и позволяет пользователю переходить НАЗАД или СЛЕДУЮЩИЙ. Могут поменять пару полей, или удалить запись.
У меня вроде работает. Форма работает правильно, рисуя первую запись, как и ожидалось.

Но когда я нажимаю СЛЕДУЮЩИЙ или ПРЕДЫДУЩИЙ, информация на экране не обновляется (даже несмотря на то, что он правильно переходит к следующей или предыдущей записи в данных. Я подтвердил это, используя точки останова и проверяя данные.)
Это мой текущий ASPX:
Код: Выделить всё
TypeName="ASGExecuteSQL.INLocationMaint"
PrimaryView="Locations"
>
Код: Выделить всё
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using PX.Data;
using PX.Data.BQL.Fluent;
using PX.Objects.FS;
using PX.Objects.IN;
using static PX.Data.BQL.BqlPlaceholder;
namespace ASGExecuteSQL
{
public class INLocationMaint : PXGraph
{
// Primary view for INLocation DAC
public PXCancel Cancel;
public PXSave Save;
public SelectFrom.View Locations;
public INLocationMaint()
{
// Optionally load the first record into Locations.Current to initialize data
if (Locations.Current == null)
{
Locations.Cache.AllowInsert = false; // don't let them create a blank record
INLocation firstRecord = SelectFrom.View.Select(this);
if (firstRecord != null)
{
Locations.Current = firstRecord;
}
if (Locations.Current != null)
{
var onCode = Locations.Current.LocationCD;
var onID = Locations.Current.LocationID;
var StopHere = 0;
}
}
}
protected void _(Events.RowSelected e)
{
var cache = e.Cache;
// the default display for this is Location ID, which is confusing... so...
PXUIFieldAttribute.SetDisplayName(cache, "Location Code");
}
// NEXT button action
public PXNext Next;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Next", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
protected IEnumerable next(PXAdapter adapter)
{
INLocation current = Locations.Current;
INLocation next = PXSelect
.Select(this, current.LocationID)
.FirstOrDefault();
if (next != null)
{
Locations.Current = next;
Locations.Cache.Update(next);
Locations.View.RequestRefresh();
}
return adapter.Get();
}
// PREVIOUS button action
public PXPrevious Previous;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Previous", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
protected IEnumerable previous(PXAdapter adapter)
{
INLocation current = Locations.Current;
INLocation prev = PXSelect
.Select(this, current.LocationID)
.FirstOrDefault();
if (prev != null)
{
Locations.Current = prev;
Locations.Cache.Update(prev);
Locations.View.RequestRefresh();
}
return adapter.Get();
}
// DELETE button action
public PXDelete Delete;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Delete", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
protected IEnumerable deleteLocation(PXAdapter adapter)
{
INLocation current = Locations.Current;
if (current != null)
{
Locations.Delete(current);
this.Actions.PressSave();
}
return adapter.Get();
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/793 ... xt-or-prev