axaptamicrosoft-dynamicsdynamics-ax-2012dynamics-ax-2009ax

taskSelectAll ignores focus


#define.taskSelectAll(778)
element.task(#taskSelectAll);

If I have more than one grid, the task always selects the same griddata altough the focus is on another grid. Is there a way to set the focus?


Solution

  • Set the grid's AutoDeclaration = Yes then call this code, replacing grid1 with your actual grid control:

    #define.taskSelectAll(778)
    
    element.selectControl(grid1);
    element.task(#taskSelectAll);
    

    OR if you don't want to set the AutoDeclaration = Yes and avoid the added overhead, you can do this:

    #define.taskSelectAll(778)
    
    element.selectControl(element.control(element.controlId('Grid1')));
    element.task(#taskSelectAll);