29 July 2010

Loop through multiSelect grid selection

First of all the multiSelect property of the grid should be set to YES and if you need a button to process multiple grid selection you also should activcate the MultiSelect property of this button. Otherwise it won't be enabled.
To loop through the selected rows of the grid just use the following for statement:
void clicked()
{
    SalesLine salesLine;
    ;
    super();

    for (salesLine = SalesLine_ds.getFirst(true) ? 
                     SalesLine_ds.getFirst(true) : SalesLine_ds.cursor();
         salesLine;
         salesLine = SalesLine_ds.getNext())
    {
        salesLine.doSomethingVerySpecial(:-);
    }
    SalesLine_ds.research(true);
}
Post a Comment