向格线添加额外的注释字段 [英] Add extra note field to grid line

查看:71
本文介绍了向格线添加额外的注释字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个客户想要向网格添加一个额外的注释字段。如果无法做到这一点,是否有办法在网格中拥有一个较大的文本字段,该网格使用弹出窗口编辑该字段中的大量文本?

I have a client that would like to add an extra note field to a grid. If this is not possible, is there a way to have a large text field in a grid that uses a pop up window for editing the large amount of text in that field?

优先级:
1.)如果可能,在网格中添加额外的注释字段。
2.)失败#1,有没有一种方法可以添加一个弹出窗口来编辑大型标准用户文本字段。

Priority: 1.) Add extra note field to grid, if possible. 2.) Failing #1, is there a way to add a popup window to edit a large standard user text field.

推荐答案

我相信您的1号问题的答案是否定的。如果网格已经有一个注释,则不能再有一个注释。我曾经有这个问题。

I believe the answer to your number 1 question is no. If the grid already has a note it cannot have another. I had this question come up before.

对于#2,您应该能够创建一个显示您的字段的智能面板。使用PXTextEdit并为面板设置一个新视图以根据您选择的/当前行来指向。

For #2, you should be able to do a smart panel that displays your field. Use a PXTextEdit and setup a new view for the panel to point to based on your selected/current row.

要添加智能面板(弹出面板),您需要少数事情到位。我更喜欢将AEF与图形和表格扩展一起使用。 T200 / T300培训材料中有关于这些主题的文档。在我的示例中,我将注释功能添加到销售订单页面。我从现有的 PO Link按钮和面板(即POSupplyOK PXAction和currentposupply视图)复制了大部分逻辑(页面SO301000)。

To add a smart panel (pop up panel) you need a handful of things in place. I prefer using AEF with graph and table extensions. There is documentation in the T200/T300 training material for these topics. In my example I add the note ability to the sales order page. I copied most of the logic from the existing "PO Link" button and panel which is the POSupplyOK PXAction and the currentposupply view (page SO301000).

首先,您需要新的我们将其添加为扩展表/字段的字段:

First you need your new field which we will add to the sales line as an extension table/field:

 [PXTable(typeof(SOLine.orderType), typeof(SOLine.orderNbr), typeof(SOLine.lineNbr), IsOptional = true)]
public class SOLineExtension : PXCacheExtension<SOLine>
{
    #region XXMyNote
    public abstract class xXMyNote : PX.Data.IBqlField
    {
    }
    protected string _XXMyNote;
    [PXDBString]
    [PXUIField(DisplayName = "My Note")]
    public virtual string XXMyNote
    {
        get
        {
            return this._XXMyNote;
        }
        set
        {
            this._XXMyNote = value;
        }
    }
    #endregion
}

然后,我们需要创建一个新的图形扩展,以为该面板添加视图,并为打开该面板添加按钮的PXAction。

Then we need to create a new graph extension to add the view for the panel and the PXAction for the button to open the panel.

public class SOOrderEntryExtension : PXGraphExtension<SOOrderEntry>
{

    public PXSelect<SOLine,
        Where<SOLine.orderType, Equal<Current<SOLine.orderType>>,
            And<SOLine.orderNbr, Equal<Current<SOLine.orderNbr>>,
                And<SOLine.lineNbr, Equal<Current<SOLine.lineNbr>>>>>> MyPanelView;

    public PXAction<SOOrder> myNoteAction;
    [PXUIField(DisplayName = "Add Note", MapViewRights = PXCacheRights.Select, MapEnableRights = PXCacheRights.Update)]
    [PXButton(ImageKey = PX.Web.UI.Sprite.Main.DataEntryF)]
    protected virtual IEnumerable MyNoteAction(PXAdapter adapter)
    {
        if (Base.Transactions.Current != null &&
            MyPanelView.AskExt() == WebDialogResult.OK)
        {
            //extra stuff here if needed when OK is pushed
        }

        return adapter.Get();
    }
}

现在您需要编辑销售订单页面。您需要将更改添加到自定义项目中,在此示例中,我通常直接在visual Studio中的site\pages\下编辑页面。然后回来,通过打开项目并执行以下步骤,将我的代码粘贴到定制项目中:

now you need to "edit" the sales order page. you need to get your changes into a customization project and I usually go edit the page direct in visual studio under site\pages\so in this example. Then come back and paste in my code into the customization project by opening the project and performing the following steps:


  1. 点击屏幕,然后点击+登录以添加新屏幕

  2. 输入SO301000并保存

  3. 单击SO301000超链接以打开销售订单的布局编辑器

  4. 点击操作>编辑ASPX

  5. 粘贴更改(如下所述)

  1. Click on screens and the + sign to add a new screen
  2. Enter SO301000 and save
  3. Click on the SO301000 hyperlink to open the layout editor for sales order
  4. Click Actions > Edit ASPX
  5. Paste in your changes (mentioned below)

在SO301000页面中添加以下内容:

In the SO301000 page add the following:

[1]在PXDataSource标签中添加DS回调命令

[1] Add your DS Callback command within the PXDataSource tag

<px:PXDSCallbackCommand Name="MyNoteAction" Visible="False" 
    CommitChanges="true" DependOnGrid="grid" />

[2]通过将以下内容添加到PXGrid,将按钮添加到销售线网格上方的工具栏中在文档详细信息标签中,选择网格的>> ActionBar> CustomItems标签。 (只需在页面中搜索 PO链接,即可更轻松地找到该位置,或在网格上方找到任何列出的按钮)。

[2] Add the button to the toolbar above the sales line grid by adding the following to the PXGrid > ActionBar > CustomItems tags of the grid in the Document Details tab. (just search "PO Link" in the page to find this location easier or any of the listed buttons above the grid).

<px:PXToolBarButton Text="Add Note" DependOnGrid="grid">
    <AutoCallBack Command="MyNoteAction" Target="ds" />
</px:PXToolBarButton>

[3]添加表示面板外观的面板代码。您可以根据需要调整大小,只需使用以下示例代码确保将PXTextEdit设置为使用MultiLine。查看当前的销售订单页面,以了解其适合页面语法的位置:

[3] Add the panel code which represents what the panel will look like. You can play around with the sizing to fit your needs, just make sure you set your PXTextEdit to use MultiLine using the following example code. Look at the current sales order page to know where it fits into the page syntax:

<px:PXSmartPanel ID="PXSmartPanelNote" runat="server" Caption="My Note Panel Caption"
    CaptionVisible="true" DesignView="Hidden" LoadOnDemand="true" Key="MyPanelView" CreateOnDemand="false" AutoCallBack-Enabled="true"
    AutoCallBack-Target="formMyNote" AutoCallBack-Command="Refresh" CallBackMode-CommitChanges="True" CallBackMode-PostData="Page"
    AcceptButtonID="btnMyNoteOk">
    <px:PXFormView ID="formMyNote" runat="server" DataSourceID="ds" Style="z-index: 100" Width="100%" CaptionVisible="False"
        DataMember="MyPanelView">
        <ContentStyle BackColor="Transparent" BorderStyle="None" />
        <Template>
            <px:PXLayoutRule ID="PXLayoutRule44" runat="server" StartColumn="True" LabelsWidth="S" ControlSize="XM" />
            <px:PXTextEdit ID="cstXXMyNote" runat="server" DataField="XXMyNote" TextMode="MultiLine"/>
        </Template>
    </px:PXFormView>
    <px:PXPanel ID="PXPanel10" runat="server" SkinID="Buttons">
        <px:PXButton ID="btnMyNoteOk" runat="server" DialogResult="OK" Text="OK"/>
    </px:PXPanel>
</px:PXSmartPanel>

我还没有对上述内容进行全面测试,但快速打了一下巴掌,就没有出现错误。我使用的是6.00.0955版本,但相同的步骤应在所有5.X版本中均适用。希望这会有所帮助。

I have not fully tested the above but a quick slap together brought up the panel with no errors. I was using version 6.00.0955 but the same steps should work in all 5.X versions. Hope this helps.

这篇关于向格线添加额外的注释字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆