2

使用 Microsoft Dynamics AX 2012。

我有listpage form一个引用ListPageInteraction类,只是想更改一些控件的标签/标题。为此,我需要执行以下操作:

element.form().design().control('<YourControlName>');

但我无法在ListPageInteraction课堂上使用这种方法。我决定研究类的初始化方法。但是没有办法从那里到达表单,我怎样才能到达控件并设置标签?

4

2 回答 2

5

common = this.listPage().activeRecord('Table');
if(common.isFormDataSource())
{
    fds = common.dataSource();
    fds.formRun().control(fds.formRun().controlId('ControlOfScreen')).
       userPromptText('New Description');
}

projProjectTransListPageInteraction.initializeQuery() 角度的另一个示例从表格 projProjectTransactionsListPage 的网格更改 TransDate 字段的标签

public void initializeQuery(Query _query)
{
    QueryBuildRange     transDateRange;
    // ListPageLabelChange =>
    Common              externalRecord;
    FormDataSource      frmDs;
    FormRun             formRun;
    FormControl         frmCtrl;
    // ListPageLabelChange <=
    ;

    queryBuildDataSource = _query.dataSourceTable(tableNum(ProjPostTransView));
    transDateRange = SysQuery::findOrCreateRange(queryBuildDataSource, fieldNum(ProjPostTransView, TransDate));

    // Date range is [(today's date - 30)..today's date] if not showing transactions for a particular project.
    // Date range is [(dateNull())..today's date] if showing transactions for a particular project so that all transactions are visible.
    transDateRange.value(SysQuery::range(transStartDate, systemDateGet()));

    this.linkActive(_query);

    // ListPageLabelChange =>
    externalRecord = this.listPage().activeRecord(_query.dataSourceTable(tableNum(ProjPostTransView)).name());//No intrisic function for form DS?
    if(externalRecord.isFormDataSource())
    {
        frmDs   = externalRecord.dataSource();
        formRun = frmDs.formRun();
        if(formRun)
        {
            frmCtrl = formRun.design().controlName(formControlStr(projProjectTransactionsListPage,TransDate));
            if(frmCtrl)
            {
                frmCtrl.userPromptText("newName");
            }
        }
    }
    // ListPageLabelChange <=
}

于 2013-08-13T12:27:00.110 回答
2

我认为不可能从 ListPageInteraction 中获取 FormRun 对象。如果你能做到,剩下的就很容易了:

FormControl fc = formRun.design().controlName(formcontrolstr(formName, controlName));
// etc.
于 2011-08-09T19:40:48.610 回答