係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.
留言列表