Acumatica动态多选下拉

Acumatica动态多选下拉

本文介绍了Acumatica动态多选下拉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个画面条目存储交易数据,我想用动态的是多选组合框以选择状态和状态数据从拍摄,但是当一些被选择的数据的状态的,所存储的数据的量确实的不匹配已被选择,

I have a screen entry to store transaction data, I want to use dynamic with multiselect combobox to select status and status data is taken from the table, but when some of the data status is selected, the amount of stored data does not match that has been selected,

我曾尝试下面的代码,但它的。不为我工作。

I have tried the following code, but it's doesn't work for me.

 public class StatusMultiStringListAttribute : PXStringListAttribute
{
    public StatusMultiStringListAttribute() : base()
    {
        PXResultset<StatusTable> rslt = PXSelect<StatusTable>.Select(new PXGraph());
        List<string> values = new List<string>();
        List<string> labels = new List<string>();
        foreach (PXResult<StatusTable> item in rslt)
        {
            BSMTStatus e = (StatusTable)item;
            values.Add(e.StatusID);
            labels.Add(e.Description);
        }

        this._AllowedValues = values.ToArray();
        this._AllowedLabels = labels.ToArray();
        MultiSelect = true;
    }
}



还有没有其他的解决方案,对不起我的英语不好,谢谢。

is there any other solution, sorry my English is bad, thanks.

推荐答案

我注意到的,看到你贴一些额外的代码。根据您的示例代码中,我提出了两个问题:

I noticed your comment on http://asiablog.acumatica.com/2016/03/multiselect-combo-box.html and saw that you posted some additional code. Based on your sample code, I identified two problems:

首先,你从StatusTable DAC装载值包含尾随这是不剪裁空间。您还没有提供StatusTable DAC的声明,但它是安全的,从你的截图假设这个字段设置为真实的 IsFixed设定属性。通过这些设置,系统会在你的价值的末尾添加空格。要保存在目标领域的空间,我会推荐给修剪()添加到构造的代码:

First of all, the values you're loading from the StatusTable DAC contain trailing spaces which are not trimmed. You haven't provided the declaration of the StatusTable DAC, but it's safe to assume from your screenshot that this field has the IsFixed attribute set to true. With these settings, the system will add white space at the end of your value. To save space in the target field, I would recommend to add a Trim() to the constructor code:

foreach (PXResult<StatusTable> item in rslt)
{
    BSMTStatus e = (StatusTable)item;
    values.Add(e.StatusID.Trim()); //Remove any white-space
    labels.Add(e.Description);
}



二,你在哪里存储选定值的状态字段不长足以容纳多重选择。它目前被定义为20个字符( [PXDBString(20,IsFixed设定= TRUE)] ),甚至假设你删除,你仍然会被限制在4个选项中的空白。我建议你将其更改为255,也删除 IsFixed设定= TRUE ,因为它并不需要此字段:

Second, the status field where you're storing the selected values is not long enough to accommodate multiple selections. It's currently defined as 20 characters ([PXDBString(20, IsFixed=true)]), and even assuming you remove the whitespace you would still be limited to 4 choices. I suggest you to change it to 255, and to also remove IsFixed=true since it's not needed for this field:

[PXDBString(255)]
[PXDefault]
[PXUIField(DisplayName = "Status")]
[StatusStringList]
public virtual string Status

这篇关于Acumatica动态多选下拉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 03:15