How to: Enable and Disable an Action Pane Button on a List Page [AX 2012]
Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
The only buttons in the action pane that should be enabled are those that perform valid actions for the current selection in the list. Buttons that cannot perform an action must appear in a disabled state. When the user changes the selection in the list, the enabled and disabled state of each button must be updated based on the new selection.
For example, you can use the Multiselect property to enable and disable an action pane button that performs an action on a single record. In some cases, the criteria for enabling and disabling an action pane button may be more complex, and must be done with code. The following procedure shows how to add code that enables and disables action pane buttons based on the selection in the list.
To enable or disable an action pane button
In the AOT, expand Forms and find the form for the list page where the action pane button appears. Use the InteractionClass property of the form to get the name of the interaction class for the list page.
Expand Designs, expand Design, and then expand the Action Pane. Get the name of each action pane button that you want to enable or disable based on the list selection.
Expand Classes, right-click the interaction class for the list page, click Override Method, and then click selectionChanged. The Editor window opens and displays the selectionChanged method.
Tip If you have to enable and disable several controls in the selectionChanged method, the code in the method can become difficult to implement and maintain. In this situation, you might want to add new methods to the list page interaction class that enable or disable specified action pane button controls. You could then use the selectionChanged method to call these methods.
Use the list page activeRecord method to get a reference to the current record in the list page grid. To use the method, you have to supply the name of the data source for the list page.
The following code example shows how to reference the current record in a grid that shows customer records. Notice the use of the queryDataSourceStr function to specify the name of the data source. In the example, CustTableListPage is the name of the query and CustTable is the data source of that query.
Public void selectionChanged()
{
CustTable custTableCurrent = this.listPage().activeRecord(queryDataSourceStr(CustTableListPage, CustTable)); super();
}Add the criteria that you use to enable or disable the action pane button.
For example, you have a button in the action pane of a customer list page that you use to assign a credit limit to a customer. If the customer already has a credit limit, you want that button to appear as a disabled button. If the customer does not have a credit limit, you want that button to appear as an enabled button.
Use the actionPaneControlEnabled method of the list page to enable or disable the button. To use the method, you specify the name of the button control and whether to enable or disable the control.
The following code example shows how to enable or disable a specified action pane button. Notice the use of the formControlStr function to get the name of the button control. In the example, CustTableListPage is the name of the form and SetCreditMax is the name of action pane button.
Public void selectionChanged()
{
CustTable custTableCurrent = this.listPage().activeRecord(queryDataSourceStr(CustTableListPage, CustTable)); super(); if(custTableCurrent.CreditMax > 0)
{
this.listPage().actionPaneControlEnabled(formControlStr(CustTableListPage, SetCreditMax), false); }
else
{
this.listPage().actionPaneControlEnabled(formControlStr(CustTableListPage, SetCreditMax), true); }
}In the Editor window, click Compile. Close the Editor window.
- http://msdn.microsoft.com/zh-cn/library/cc570334.aspx
How to: Enable and Disable an Action Pane Button on a List Page [AX 2012]的更多相关文章
- How to detect, enable and disable SMBv1, SMBv2, and SMBv3 in Windows and Windows Server
转自:https://support.microsoft.com/en-us/help/2696547/detect-enable-disable-smbv1-smbv2-smbv3-in-windo ...
- Oracle ->> ENABLE VALIDATE & DISABLE VALIDATE
这里找到一篇博文对这两个用法的解释:http://www.cnblogs.com/rootq/archive/2008/09/23/1297400.html 启用约束: enable( validat ...
- KnockoutJS 3.X API 第四章 表单绑定(8) submit、enable、disable绑定
submit绑定目的 submit绑定即为提交绑定,通常用于form元素.这种绑定方式会打断默认的提交至服务器的操作.转而提交到你设定好的提交绑定回调函数中.如果要打破这个默认规则,只需要在回调函数中 ...
- enable or disable Oracle block change tracking
Oracle的block change tracking用于记录上次备份以来改变过的block信息,因此打开block change tracking可以大大加快增量备份的速度. 1. Enable ...
- [Windows Hyper-V-Server]Enable or disable firewall rules under powershell / powershell下启用禁用防火墙规则
http://www.cryer.co.uk/brian/windows/hyper-v-server/help_computer_cannot_be_managed.htm Enable COM+ ...
- How to Enable or Disable a cell in DataGridview Row ?
Following link http://msdn.microsoft.com/en-us/library/ms171619.aspxhttp://windowsclient.net/blogs/f ...
- ubuntu14.04LTS安装vmware10.0.1
因为所用Ubuntu系统是32位,而VMware最新版本又不支持32位,只好下载以前版本vmware10.0.1. vmware10.0.1下载地址: http://down.it168.com/1 ...
- HIVE编程指南之HiveQL的学习笔记1
// HiveQLa) 数据定义语言1 数据库表的一个目录或命名空间,如果用户没有指定数据库的话,那么将会使用默认的数据库default-----创建数据库CREATE DATABASE guoyon ...
- 转 OGG Troubleshooting-Database error 1 (ORA-00001: unique constraint ...)
Q5: After imp data to target, when we start replc process, we find the following error: 2011-11-10 0 ...
随机推荐
- hadoop中hbase出现的问题
在安装hbase中出现问题如下: ERROR: Can't get master address from ZooKeeper; znode data == null 解决办法: 1.删除nameno ...
- 基础连接已经关闭: 未能为SSL/TLS 安全通道建立信任关系
#region private static bool ValidateServerCertificate 解决Error"基础连接已经关闭: 未能为SSL/TLS 安全通道建立信任关系.& ...
- Spring MVC 学习笔记(整理)
SpringMVC学习 1.概述 Spring MVC是一种基于Java实现MVC设计模式的请求驱动类型的轻量级Web框架,即使用了MVC架构模式的思想,将web层进行解耦,基于请求-响应模型帮助我们 ...
- [转]移动App测试中的最佳做法
Daniel Knott 用过各种不同编程语言和软件质量保证工具.他在软件开发和测试方面干了七年,自2010年起,他一直在德国汉堡的XING AG公司就职,几个项目里,比如XING调查和XING建议, ...
- iOS10.1不能调试解决方案
对于一些有强迫证的程序员来说只要苹果更新系统,会马上更新,但是军哥更新过10.1的系统后发现Xcode8不能调试了 苹果这次太不人性话了,解决办法,最简单的是 拷贝iOS10.1支持文件放在Xcode ...
- SQL SERVER 中的行列转换小结
1. 介绍说明 前段时间组内的小伙伴在升级维护项目中,经常涉及一些复杂的数据转换问题,让我去看下有些地方怎么处理,我发现好多都是涉及到行列转换的问题,处理起来经常会比较麻烦,借此也总结一下,方便以后的 ...
- OS中常用的调度算法总结 (转)
http://blog.chinaunix.net/uid-25132162-id-361291.html 一.常见的批处理作业调度算法 1.先来先服务调度算法(FCFS):就是按照各个作业进入系统的 ...
- AMQ学习笔记 - 14. 实践方案:基于ZooKeeper + ActiveMQ + replicatedLevelDB的主从部署
概述 基于ZooKeeper + ActiveMQ + replicatedLevelDB,在Windows平台的主从部署方案. 主从部署可以提供数据备份.容错[1]的功能,但是不能提供负载均衡的功能 ...
- php面向对象的多态
多态是指使用类的上下文来重新定义或改变类的性质或行为,或者说接口的多种不同的实现方式即为多态.把不同的子类对象都当成父类来看,可以屏蔽不同子类对象之间的差异,写出通用的代码,做出通用的编程,以适应需要 ...
- jquery.cookie.js 使用方法
Cookies 定义:让网站服务器把少量数据储存到客户端的硬盘或内存,从客户端的硬盘读取数据的一种技术: 下载与引入:jquery.cookie.js基于jquery:先引入jquery,再引入:jq ...