Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
586 views
in Technique[技术] by (71.8m points)

acumatica - Changing the Default Option for Column Filters

Is it possible to change the default option all column filters? I'm pretty sure I can accomplish this with some JavaScript, but I'd like to know if there's any way within the Acumatica framework to change this. Filter Dropdown


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The answer will be no. The filter is inside the PX.Web.UI.dll in the PXGridFilter class which is an internal class. The property that you are interested in is the Condition.

The value is set inside one of the private methods of the PXGrid class. The code of the method is below:

private IEnumerable<PXGridFilter> ab()
{
    List<PXGridFilter> list = new List<PXGridFilter>();
    if (this.FilterID != null)
    {
        Guid? filterID = this.FilterID;
        Guid guid = PXGrid.k;
        if (filterID == null || (filterID != null && filterID.GetValueOrDefault() != guid))
        {
            using (IEnumerator<PXResult<FilterRow>> enumerator = PXSelectBase<FilterRow, PXSelect<FilterRow, Where<FilterRow.filterID, Equal<Required<FilterRow.filterID>>, And<FilterRow.isUsed, Equal<True>>>>.Config>.Select(this.DataGraph, new object[]
            {
                this.FilterID.Value
            }).GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    FilterRow row = enumerator.Current;
                    string dataField = row.DataField;
                    PXCache pxcache = PXFilterDetailView.TargetCache(this.DataGraph, new Guid?(this.FilterID.Value), ref dataField);
                    if (this.Columns[row.DataField] != null)
                    {
                        List<PXGridFilter> list2 = list;
                        int valueOrDefault = row.OpenBrackets.GetValueOrDefault();
                        string dataField2 = row.DataField;
                        string dataField3 = row.DataField;
                        int value = (int)row.Condition.Value;
                        object value2 = pxcache.ValueFromString(dataField, row.ValueSt);
                        string valueText = row.ValueSt.With((string _) => this.Columns[row.DataField].FormatValue(_));
                        object value3 = pxcache.ValueFromString(dataField, row.ValueSt2);
                        string value2Text = row.ValueSt2.With((string _) => this.Columns[row.DataField].FormatValue(_));
                        int valueOrDefault2 = row.CloseBrackets.GetValueOrDefault();
                        int? @operator = row.Operator;
                        int num = 1;
                        list2.Add(new PXGridFilter(valueOrDefault, dataField2, dataField3, value, value2, valueText, value3, value2Text, valueOrDefault2, @operator.GetValueOrDefault() == num & @operator != null));
                    }
                }
                return list;
            }
        }
    }
    if (this.FilterRows != null && this.FilterRows.Count > 0)
    {
        for (int i = 0; i < this.FilterRows.Count; i++)
        {
            PXFilterRow row = this.FilterRows[i];
            list.Add(new PXGridFilter(row.OpenBrackets, row.DataField, row.DataField, (int)row.Condition, row.Value, row.Value.With(delegate(object _)
            {
                if (this.Columns[row.DataField] == null)
                {
                    return _.ToString();
                }
                return this.Columns[row.DataField].FormatValue(_);
            }), row.Value2, row.Value2.With(delegate(object _)
            {
                if (this.Columns[row.DataField] == null)
                {
                    return _.ToString();
                }
                return this.Columns[row.DataField].FormatValue(_);
            }), row.CloseBrackets, row.OrOperator));
        }
    }
    return list;
}

UPDATE

The below JS code allows you to change the condition of the last set filter:

px_all.ctl00_phG_grid_fd.show();
px_all.ctl00_phG_grid_fd_cond.items.items[7].setChecked(true);
px_all.ctl00_phG_grid_fd_ok.element.click();

px_all.ctl00_phG_grid_fd_cond.items.items[7].value "EQ" px_all.ctl00_phG_grid_fd_cond.items.items[8].value "NE" px_all.ctl00_phG_grid_fd_cond.items.items[9].value "GT" px_all.ctl00_phG_grid_fd_cond.items.items[13].value "LIKE" px_all.ctl00_phG_grid_fd_cond.items.items[14].value "LLIKE" px_all.ctl00_phG_grid_fd_cond.items.items[15].value "RLIKE" px_all.ctl00_phG_grid_fd_cond.items.items[16].value "NOTLIKE" px_all.ctl00_phG_grid_fd_cond.items.items[18].value "ISNULL" px_all.ctl00_phG_grid_fd_cond.items.items[19].value "ISNOTNULL"


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...