将 Excel 上传控件添加到网格工具栏

Add Excel upload control to grid toolbar

有没有办法获得允许从 Excel sheet 上传数据的网格控件?我还没有找到将此控件放在工具栏上的命令。

您需要用 PXImportAttribute 修饰数据视图。

示例:

[PXViewName(Messages.SOLine)]
[PXImport(typeof(SOOrder))]
[PXCopyPasteHiddenFields(typeof(SOLine.completed))]
public PXSelect<SOLine, Where<SOLine.orderType, Equal<Current<SOOrder.orderType>>, 
             And<SOLine.orderNbr, Equal<Current<SOOrder.orderNbr>>>>,OrderBy<Asc<SOLine.orderType, Asc<SOLine.orderNbr, Asc<SOLine.lineNbr>>>>> Transactions;

PXImport 属性使用户能够将数据从文件加载到网格。该属性位于网格用于检索数据的数据视图上。

我们使用了 PXImportAttribute(Type) 构造函数,其中输入参数是第一个(主要)DAC,该 DAC 由声明当前视图的图形的主视图引用。

将 Grid 的 AllowUpload 属性 设置为 True

AllowUpload 属性 控制 Load Records from file 工具栏按钮的显示。