gpt4 book ai didi

axapta - View 上的表单数据源编辑方法 - AX 2009

转载 作者:行者123 更新时间:2023-12-05 03:13:45 26 4
gpt4 key购买 nike

我正在尝试从表单中的数据源向我的网格添加一个编辑方法。我有以下编辑方法代码:

edit boolean markLine(
boolean set,
Datasource _datasource,
boolean _mark
)
{
if (set)
{
if (!_mark)
{
if (selectedLines.exists(_datasource.RecId))
{
selectedLines.remove(_datasource.RecId);
}
}
else
{
selectedLines.insert(_datasource.RecId,_datasource.recVersion);
}
}

return selectedLines.exists(_datasource.RecId);
}

然后我将它拖到一个网格中,该网格中指定了数据源并包含来自该数据源的其他字段。然而,当我尝试在网格中使用它时,无法选中该框。

我正在为我的数据源使用 View ,而不是表格。我不确定这是否是它的原因,或者是否还有其他问题。知道这里可能有什么问题吗?

提前致谢。

编辑

数据源上的 AllowEdit 为真。

最佳答案

好的,我又检查了一些,在 AX 文档中找到了以下关于 View 的内容

Views are read-only. The data fields and tables that a view uses cannot be updated from that view.

因此,编辑方法将不起作用,因为首先无法编辑 View 。

编辑

解决方法是覆盖网格中的 mouseDblClick 方法。在 super() 之后添加以下代码行:

Datasource_ds.selectedLines(true, Datasource, !selectedLines.exists(Datasource.RecId));
Datasource_ds.refresh();

然后当用户双击一个方法时,它就被选中了。

关于axapta - View 上的表单数据源编辑方法 - AX 2009,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28904390/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com