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

  1. 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.

  2. 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.

  3. 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.

  4. 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();
    }
  5. 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.

  6. 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); }
    }
  7. In the Editor window, click Compile. Close the Editor window.

  8. http://msdn.microsoft.com/zh-cn/library/cc570334.aspx

How to: Enable and Disable an Action Pane Button on a List Page [AX 2012]的更多相关文章

  1. 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 ...

  2. Oracle ->> ENABLE VALIDATE & DISABLE VALIDATE

    这里找到一篇博文对这两个用法的解释:http://www.cnblogs.com/rootq/archive/2008/09/23/1297400.html 启用约束: enable( validat ...

  3. KnockoutJS 3.X API 第四章 表单绑定(8) submit、enable、disable绑定

    submit绑定目的 submit绑定即为提交绑定,通常用于form元素.这种绑定方式会打断默认的提交至服务器的操作.转而提交到你设定好的提交绑定回调函数中.如果要打破这个默认规则,只需要在回调函数中 ...

  4. enable or disable Oracle block change tracking

    Oracle的block change tracking用于记录上次备份以来改变过的block信息,因此打开block change tracking可以大大加快增量备份的速度. 1. Enable ...

  5. [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+ ...

  6. 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 ...

  7. ubuntu14.04LTS安装vmware10.0.1

    因为所用Ubuntu系统是32位,而VMware最新版本又不支持32位,只好下载以前版本vmware10.0.1. vmware10.0.1下载地址:  http://down.it168.com/1 ...

  8. HIVE编程指南之HiveQL的学习笔记1

    // HiveQLa) 数据定义语言1 数据库表的一个目录或命名空间,如果用户没有指定数据库的话,那么将会使用默认的数据库default-----创建数据库CREATE DATABASE guoyon ...

  9. 转 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 ...

随机推荐

  1. 【阿里云产品公测】一句话告诉你什么样的人该使用ACE,如何使用ACE

    作者:阿里云用户小鸡咕咕 首先回应标题,这一句话就是:看完这篇帖子你就知道了.     前言 写在文章之前,我想先阐述一下写这篇文章的意义.可能大伙就要说了,写这篇文章不就是为了200的代金券吗?错, ...

  2. hdu 1228 A+B 字符串处理 超级大水题

    中文意思不解释. 很水,我本来想用switch处理字符串,然后编译不通过...原来switch只能处理整数型的啊,我都忘了. 然后就有了很挫的一大串if代码了... 代码: #include < ...

  3. 常用排序算法之JavaScript实现

    1.插入排序 1)算法简介 插入排序(Insertion-Sort)的算法描述是一种简单直观的排序算法.它的工作原理是通过构建有序序列,对于未排序数据,在已排序序列中从 后向前扫描,找到相应位置并插入 ...

  4. jQuery选择器之层次选择器Demo

    测试代码: 02-层次选择器.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" &quo ...

  5. MVC 菜鸟学习记录1

    Asp.Net MVC 模式是一种表现模式.它将web应用程序分成三个主要组件即:    Model.View.Controller M:Model 主要是存储或者是处理数据的组件 Model其实是实 ...

  6. WPF 多语言 多资源 多皮肤 处理方案

    同时兼容这么多需求的解决方案 我想到的 只有通过 动态切换加载资源字典  前端用绑定的模式 达到托管最大化 多语言举例 我编辑了 两个 语言包 一个中文 一个英文  (语言包这个最好用T4 写个模板, ...

  7. html学习笔记1

    一.特殊按键和快捷键 键盘上除了有字母.数字之外,还有一些特殊的按键:ctrl.shift.alt.tab ● ctrl键是英语control"控制"的意思,这个按键,单独按没有任 ...

  8. WEB系统架构

    客户端方向:框架+控件+模板+元数据辅助:懒加载+合并请求+异步任务+推送+缓存技术:reactjs,requirejs,jquery,angularjs,bootstrap,ant.design,f ...

  9. 学习Slim Framework for PHP v3 (五)--route怎么被调用的?

    上一篇中分析了get()如何加入新的route的,这篇来分析route是如何被调用的. 首先,route是在routers里保存,router有在container中存放.container提供了ge ...

  10. .NET程序编译和运行

    一次面试的时候遇到的一道题目,简要说明.NET的编译过程,在网上看了很多资料,简单总结如下: 1.一般的编译过程 通常高级语言的程序编译过程是:首先写好的程序是源代码,然后编译器编译为本地机器语言,最 ...