Sort the grid on the formdatasource using INIT method
Today we have a requirement when the forms open we want to sort the field in the Decending order.
Below is the code that's helps to achieve it.
===========================================================================
Code :-
[ExtensionOf(formDataSourceStr(ProdSchedule, ProdTable))]
final class AVAProdSchedule_Extension
{
public void init()
{
next init();
this.avaSortPriority();
}
/// <summary>
/// This method is used to sort the production order with Priority field in descending order.
/// </summary>
public void avaSortPriority()
{
FormDataSource prodtableDS = element.dataSource(formDataSourceStr(ProdSchedule, ProdTable));
prodtableDS.query().dataSourceTable(tablenum(ProdTable)).addSortField(fieldnum(ProdTable, ProdPrio), SortOrder::Descending);
}
}
=========================================================================
Comments
Post a Comment