Привязка не работает при переходе к следующему или предыдущемуC#

Место общения программистов C#
Ответить Пред. темаСлед. тема
Anonymous
 Привязка не работает при переходе к следующему или предыдущему

Сообщение Anonymous »

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

Но когда я нажимаю СЛЕДУЮЩИЙ или ПРЕДЫДУЩИЙ, информация на экране не обновляется (даже несмотря на то, что он правильно переходит к следующей или предыдущей записи в данных. Я подтвердил это, используя точки останова и проверяя данные.)
Это мой текущий ASPX:

Код: Выделить всё




TypeName="ASGExecuteSQL.INLocationMaint"
PrimaryView="Locations"
>


















А это внутренний код C#:

Код: Выделить всё

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
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «C#»