Add Excel upload control to grid toolbar

自作多情 提交于 2019-12-11 02:09:45

问题


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.


回答1:


You need to decorate data view with PXImportAttribute.

Example:

[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 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.

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.

Set Grid's AllowUpload property to True.

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



来源:https://stackoverflow.com/questions/39643815/add-excel-upload-control-to-grid-toolbar

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!