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

问题描述:

有没有一种方法可以使网格控件允许从Excel表格上载数据?我还没有找到将此控件放到工具栏上的命令。

Is there a way to get the grid control that allows one to upload data from an Excel sheet? I haven't found a command that will put this control on the toolbar.

您需要用 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 属性使用户能够加载数据从文件到网格。该属性放置在网格用于检索数据的数据视图上。

PXImport attribute enables the user to load data from the file to the grid. The attribute is placed on the data view the grid uses to retrieve the data.

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

We have used PXImportAttribute(Type) constructor where input parameter is the first (Primary) DAC that is referenced by the primary view of the graph where the current view is declared.

设置网格的 AllowUpload 属性设置为 True

Set Grid's AllowUpload property to True.

AllowUpload 属性控制文件中 Load Records 工具栏按钮。

AllowUpload property controls the display of the Load Records from file toolbar button.