Thursday, 8 October 2015

Make ListPage grid Empty initiallly when opens sales orders

Go to

AOT Classes/Salestablelistpageinteraction/initializeQuery

1) This method is for automatically loaded grid records in listpage.
2) Write Else code part which mention in Blue colour for make grid empty initially.

public void initializeQuery(Query _query)
{
   QueryBuildDataSource    qbds;
   ProjInvoiceTable        projInvoiceTable;

   if (isCustomer)
   {
       EPQuery::makeMyCustomerSelfServiceQuery(_query,tableNum(SalesTable));
   }

   if (this.listPage().listPageArgs() &&
       this.listPage().listPageArgs().externalRecord() &&
       this.listPage().listPageArgs().menuItemName() ==  menuitemDisplayStr(SalesTableListPage_Proj) &&
       this.listPage().listPageArgs().externalRecord().TableId == tableNum(ProjInvoiceTable))
   {
       projInvoiceTable = this.listPage().listPageArgs().externalRecord();
       qbds = _query.dataSourceTable(tableNum(SalesTable)).addDataSource(tableNum(ProjTable));
       qbds.relations(true);
       qbds.joinMode(JoinMode::ExistsJoin);
       qbds.addRange(fieldNum(ProjTable,ProjInvoiceProjId)).value(queryValue(projInvoiceTable.ProjInvoiceProjId));
   }
   else
   {
       _query.dataSourceTable(tableNum(SalesTable)).addRange(fieldNum(SalesTable, SalesId)).value(SysQuery::valueEmptyString());
   }

   super(_query);
}

No comments:

Post a Comment