List page and form menuitem enable code
Listpage interaction class:
Code for Action pane button enable and disabling:
1. selectionChanged()
if(NetAgreement.Status == NetAgreementStatus::Approved && NetAgreement.FinalizeAgree == NoYes::No)
this.listPage().actionPaneControlEnabled(formControlStr(NetAgreementList,FinalizeAgreement),true);
else
this.listPage().actionPaneControlEnabled(formControlStr(NetAgreementList,FinalizeAgreement),false);
2. selectionChanged()
public void selectionChanged()
{
super();
this.setButtonEnabled();
if(netReservationTable.RentalApprovalState == ApprovalState::WorkflowCompleted)// && NetReservationListPage.& NetAgreement.FinalizeAgree == NoYes::No)
this.listPage().actionPaneControlEnabled(formControlStr(NetReservationListPage,btnReserve),true);
else
this.listPage().actionPaneControlEnabled(formControlStr(NetReservationListPage,btnReserve),false);
}
Action pane button enabling and disabling in form:
Form –datasource-(table of data source)-active method:
1.Active():
if(NetAgreement.Status == NetAgreementStatus::Approved && NetAgreement.FinalizeAgree == NoYes::No)
FinalizeAgreement.enabled(true);
else
FinalizeAgreement.enabled(false);
//ended by poorna...04/09/2013
return ret;
2.Active():
if(NetReservationTable.RentalApprovalState == ApprovalState::WorkflowCompleted)//&& NetAgreement.FinalizeAgree == NoYes::No)
btnReserve.enabled(true);
else
btnReserve.enabled(false);
=====================================================Listpage interaction class: example
Listpage interaction class:( NetReservationListPageInteraction-interaction class,
NetReservationListPage-listpage name , btnReserve-button name(autodeclaration yes),
NetReservation_NoFilter-listpage query, NetReservationTable-listpage table)
Class declaration:
public class NetReservationListPageInteraction extends ListPageInteraction
{
smmLeadTable smmLeadTable;
smmActivityParentLinkTable smmActivityParentLinkTable;
QueryBuildRange leadProcessRange;
HierarchyName selectedProcess;
NetReservationTable netReservationTable;
}
selectionChanged:
public void selectionChanged()
{
super();
this.setButtonEnabled();
if(netReservationTable.RentalApprovalState == ApprovalState::WorkflowCompleted)// && NetReservationListPage.& NetAgreement.FinalizeAgree == NoYes::No)
this.listPage().actionPaneControlEnabled(formControlStr(NetReservationListPage,btnReserve),true);
else
this.listPage().actionPaneControlEnabled(formControlStr(NetReservationListPage,btnReserve),false);
}
setButtonEnabled:
void setButtonEnabled ()
{
boolean isCustomer;
smmOpportunityTable smmOpportunityTable;
boolean enableContacts = false;
DirOrgPersonRelations dirOrgPersonRelations;
netReservationTable = this.listPage().activeRecord(queryDataSourceStr(NetReservation_NoFilter, NetReservationTable));
/* isCustomer = DirPartyTable::isCustomer(netReservationTable.Party);
if (!netReservationTable.RecId || !netReservationTable.Party || isCustomer)
{
this.listPage().actionPaneControlEnabled(formControlStr(NetReservationListPage,createCustomer),false);
}
else
{
this.listPage().actionPaneControlEnabled(formControlStr(NetReservationListPage,createCustomer),true);
}
this.listPage().actionPaneControlEnabled(formControlStr(NetReservationListPage,customerButton),netReservationTable.RecId != 0 && isCustomer);
*/
}
setDBEnabled:
public void setDBEnabled()
{
boolean isDraft;
;
/*
// DNS-Hussain on 12-09-2013
netReservationTable = this.listPage().activeRecord(queryDataSourceStr(NetReservation_NoFilter, NetReservationTable));
isDraft = netReservationTable.RentalApprovalState == ApprovalState::NotSubmitted;
if(NetReservationTable.RentalApprovalState != ApprovalState::NotSubmitted)
{
NetReservationTable_ds.allowEdit(isDraft);
NetReservationTable_ds.allowDelete(isDraft);
}
// end.
this.setButtonEnabled();
if(netReservationTable.RentalApprovalState == ApprovalState::WorkflowCompleted)// && NetReservationListPage.& NetAgreement.FinalizeAgree == NoYes::No)
this.listPage().actionPaneControlEnabled(formControlStr(NetReservationListPage,btnReserve),true);
else
this.listPage().actionPaneControlEnabled(formControlStr(NetReservationListPage,btnReserve),false);
*/
==========================================================================================================
listpage enabling override methods(How to write methods on the list page Form in Ax 2012)
for enabling default override methods in list page we will set on property to group as
display target-- client(defautly it is auto we can change as client)
display target-- client(defautly it is auto we can change as client)
Scenario: I have a menu item that calls some class to do manipulation on the list page Form and I need to refresh the list page now. List pages do not allow writing of code on the Form, as they used interaction class.
Solution: You can write the code on list page buttons by setting DisplayTarget property to “Client” from auto. However after this change, you won’t be able to sue this button on the EP, so if you are thinking of using the same list page on the EP and planning to use the same button there, then do not do it. However f your domain is only the Form then you are good to do this.
Any ways override the clicked method and call research() of the data source to do this
No comments:
Post a Comment