Friday, September 18, 2020

AX - How to sort datasource

Simple add into datasource Init() method this code:
public void init()
{
  super();    
           
  smmEncyclopediaItems_ds.query().dataSourceNo( 1 ).
    addSortField( fieldNum( smmEncyclopediaItems, ParentId ), SortOrder::Ascending );
  smmEncyclopediaItems_ds.query().dataSourceNo( 1 ).
    addSortField( fieldNum( smmEncyclopediaItems, order ), SortOrder::Ascending );
  smmEncyclopediaItems_ds.query().dataSourceNo( 1 ).
    addSortField( fieldNum( smmEncyclopediaItems, ItemName ), SortOrder::Ascending );        
}

No comments:

Post a Comment