係AX grid 度拎返已揀選了的records. (使用MultiSelectionHelper class)

(Button):

void clicked()

{
    MultiSelectionHelper          selectionHelper = MultiSelectionHelper::construct();//Create instance of class
    Set                           selectedRecords = new Set(Types::Record);//Declare a set of type record
    MyLinesTable                  tableLines; //Your table buffer
    super();
 
    selectionHelper.parmDataSource(MyLinesTable_DS); //Set the datasource
    tableLines  = selectionHelper.getFirst(); //assign to table buffer the reference to selected record(s)
 
    if (tableLines.RecId)
    {
        while (tableLines)
        {
            selectedRecords.add(tableLines);
            info(strFmt('Selected record.. %1',tableLines.myField));//Display selected record
            tableLines = selectionHelper.getNext();
        }
    }
}
 
3. Select record(s) on the grid then click on the command button to view the selected records.

 

arrow
arrow
    文章標籤
    Dynamics AX D365
    全站熱搜

    lionlionchopper 發表在 痞客邦 留言(0) 人氣()