Tuesday, 18 March 2014

How to Enable Disable Button Of list page using interaction class in ax 2012

Listpage interaction class: example

Listpage interaction class:( S3HrLeaveResquestListPageInteraction-interaction class,
S3HRLeaveRequestListPage-listpage name , DeleteCommandButton-button name(autodeclaration yes),
S3HRLeaveRequestListPage-listpage query, S3HRLeaveRequest_1-listpage table)


Create New Class & Write below code:=

public class S3HrLeaveResquestListPageInteraction extends SysListPageInteractionBase
{
    S3HRLeaveRequest S3HRLeaveRequest;
}


public void selectionChanged()
    {
S3HRLeaveRequest leaverequestCurrent = this.listPage().activeRecord(queryDataSourceStr(S3HRLeaveRequestListPage, S3HRLeaveRequest_1));
super();
 if(leaverequestCurrent.LeaveRequestApprovalStatus ==              S3HRLeaveRequestApproval::NotSubmitted)
        {
          this.listPage().actionPaneControlEnabled(formControlStr(S3HRLeaveRequestListPage,             DeleteCommandButton), true);
        }
        else
        {
            this.listPage().actionPaneControlEnabled(formControlStr(S3HRLeaveRequestListPage,             DeleteCommandButton), false);
        }
    }

Now extend this class to the form.


No comments:

Post a Comment