自定义网格空

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了自定义网格空相关的知识,希望对你有一定的参考价值。

真的很简单但令人生气的问题。

1)创建了一个DB脚本,用于向数据库添加字段并发布。 2)根据改变的表创建一个新的DAC。 3)创建了一个新的屏幕和图形。 4)改变图形以指向#2中创建的DAC。

问题:网格是空的,我无法让它显示任何东西。

通过从数据库加载生成的DAC(无更改):

  [Serializable]
  public class INItemXRef : IBqlTable
  
    #region InventoryID
    [PXDBInt(IsKey = true)]
    [PXUIField(DisplayName = "Inventory ID")]
    public virtual int? InventoryID  get; set; 
    public abstract class inventoryID : IBqlField  
    #endregion

    #region SubItemID
    [PXDBInt(IsKey = true)]
    [PXUIField(DisplayName = "Sub Item ID")]
    public virtual int? SubItemID  get; set; 
    public abstract class subItemID : IBqlField  
    #endregion

    #region AlternateType
    [PXDBString(4, IsKey = true, InputMask = "")]
    [PXUIField(DisplayName = "Alternate Type")]
    public virtual string AlternateType  get; set; 
    public abstract class alternateType : IBqlField  
    #endregion

    #region BAccountID
    [PXDBInt(IsKey = true)]
    [PXUIField(DisplayName = "BAccount ID")]
    public virtual int? BAccountID  get; set; 
    public abstract class bAccountID : IBqlField  
    #endregion

    #region AlternateID
    [PXDBString(50, IsKey = true, IsUnicode = true, InputMask = "")]
    [PXUIField(DisplayName = "Alternate ID")]
    public virtual string AlternateID  get; set; 
    public abstract class alternateID : IBqlField  
    #endregion

    #region Descr
    [PXDBString(256, IsUnicode = true, InputMask = "")]
    [PXUIField(DisplayName = "Descr")]
    public virtual string Descr  get; set; 
    public abstract class descr : IBqlField  
    #endregion

    #region Uom
    [PXDBString(6, IsUnicode = true, InputMask = "")]
    [PXUIField(DisplayName = "Uom")]
    public virtual string Uom  get; set; 
    public abstract class uom : IBqlField  
    #endregion

    #region CreatedByID
    [PXDBCreatedByID()]
    public virtual Guid? CreatedByID  get; set; 
    public abstract class createdByID : IBqlField  
    #endregion

    #region CreatedByScreenID
    [PXDBCreatedByScreenID()]
    public virtual string CreatedByScreenID  get; set; 
    public abstract class createdByScreenID : IBqlField  
    #endregion

    #region CreatedDateTime
    [PXDBDate()]
    [PXUIField(DisplayName = "Created Date Time")]
    public virtual DateTime? CreatedDateTime  get; set; 
    public abstract class createdDateTime : IBqlField  
    #endregion

    #region LastModifiedByID
    [PXDBLastModifiedByID()]
    public virtual Guid? LastModifiedByID  get; set; 
    public abstract class lastModifiedByID : IBqlField  
    #endregion

    #region LastModifiedByScreenID
    [PXDBLastModifiedByScreenID()]
    public virtual string LastModifiedByScreenID  get; set; 
    public abstract class lastModifiedByScreenID : IBqlField  
    #endregion

    #region LastModifiedDateTime
    [PXDBDate()]
    [PXUIField(DisplayName = "Last Modified Date Time")]
    public virtual DateTime? LastModifiedDateTime  get; set; 
    public abstract class lastModifiedDateTime : IBqlField  
    #endregion

    #region Tstamp
    [PXDBTimestamp()]
    [PXUIField(DisplayName = "Tstamp")]
    public virtual byte[] Tstamp  get; set; 
    public abstract class tstamp : IBqlField  
    #endregion

    #region UsrNoteID
    [PXDBGuid()]
    [PXUIField(DisplayName = "Usr Note ID")]
    public virtual Guid? UsrNoteID  get; set; 
    public abstract class usrNoteID : IBqlField  
    #endregion

    #region UsrTemp
    [PXDBString(20, IsUnicode = true, InputMask = "")]
    [PXUIField(DisplayName = "Usr Temp")]
    public virtual string UsrTemp  get; set; 
    public abstract class usrTemp : IBqlField  
    #endregion

    #region Noteid
    [PXDBGuid()]
    [PXUIField(DisplayName = "Noteid")]
    public virtual Guid? Noteid  get; set; 
    public abstract class noteid : IBqlField  
    #endregion
  

屏幕图(仅改变视图以使用上面的DAC):

using System;
using PX.Data;

namespace PennAirSales

  public class INItemXRefBLC : PXGraph<INItemXRefBLC>
  

    public PXSave<INItemXRef> Save;
    public PXCancel<INItemXRef> Cancel;


    public PXFilter<INItemXRef> MasterView;
    public PXFilter<INItemXRef> DetailsView;

    //[Serializable]
    //public class MasterTable : IBqlTable
    //

    //

    //[Serializable]
    //public class DetailsTable : IBqlTable
    //

    //
  

ASPX(无变化)

<%@ Page Language="C#" MasterPageFile="~/MasterPages/ListView.master" AutoEventWireup="true" ValidateRequest="false" CodeFile="IN202599.aspx.cs" Inherits="Page_IN202599" Title="Untitled Page" %>
<%@ MasterType VirtualPath="~/MasterPages/ListView.master" %>

<asp:Content ID="cont1" ContentPlaceHolderID="phDS" Runat="Server">
    <px:PXDataSource ID="ds" runat="server" Visible="True" Width="100%"
        TypeName="PennAirSales.INItemXRefBLC"
        PrimaryView="MasterView"
        >
        <CallbackCommands>

        </CallbackCommands>
    </px:PXDataSource>
</asp:Content>
<asp:Content ID="cont2" ContentPlaceHolderID="phL" runat="Server">
    <px:PXGrid ID="grid" runat="server" DataSourceID="ds" Width="100%" Height="150px" SkinID="Primary" AllowAutoHide="false">
        <Levels>
            <px:PXGridLevel DataMember="DetailsView">
                <Columns>
                <px:PXGridColumn DataField="AlternateID" Width="180" />
                <px:PXGridColumn DataField="AlternateType" Width="70" />
                <px:PXGridColumn DataField="Descr" Width="280" />
                <px:PXGridColumn DataField="InventoryID" Width="70" />
                <px:PXGridColumn DataField="BAccountID" Width="70" />
                <px:PXGridColumn DataField="NoteID" Width="70" /></Columns>
            </px:PXGridLevel>
        </Levels>
        <AutoSize Container="Window" Enabled="True" MinHeight="150" />
        <ActionBar >
        </ActionBar>
    </px:PXGrid>
</asp:Content>

这是如此直截了当我无法理解为什么没有数据被拉(在一般查询中可以看到数据很好),看起来这是非常明显的我错过了...

答案

您需要一个不是过滤器的视图(PXSelect vs PXFilter)

尝试:

public PXSelect<INItemXRef> DetailsView;

以上是关于自定义网格空的主要内容,如果未能解决你的问题,请参考以下文章

在 Visual Composer 自定义网格模板上显示自定义字段图像

R语言使用caret包对GBM模型自定义参数调优:自定义参数优化网格

如何获得自定义网格的自定义材料

具有自定义网格视图的 AsyncTask

Vue.js - 带有自定义叠加层的自定义照片网格

当我们单击网格列(即单击网格列)时,自定义日期排序不起作用