Knowledge Base Article

> Knowledge Base > Rapise

Created By  dmarkovtsev Thursday, August 23, 2018

Rapise 5.7+ performs scrolling automatically before clicking on a cell. Also there is DoScroll action that does explicit scrolling.

In Rapise 5.6 and below use this simple function to scroll your Dynamics NAV table left, right, up, bottom.

/**
 * Performs line/column scrolling of a table specified by objId.
 * @param objId Id of the table in the object tree.
 * @param vertical Number of scroll button hits for vertical scrolling. Positive values mean
 *                 scrolling down, negative - up.
 * @param horizontal Number of scroll button hits for horizontal scrolling. Positive values
  *                mean scrolling right, nagative - left.
 */
function DynamicsNAVTable_ScrollTo(/**objectId*/ objId, /**number*/ vertical, /**number*/ horizontal)
{
    var grid = SeS(objId);
    if (!grid)
    {
        return false;
    }
    
    var hScrollBar = grid.GetChildAt(0);
    if (hScrollBar.GetTypeName() == "ScrollBar")
    {
        var button = horizontal > 0 ? hScrollBar.GetChildAt(3) : hScrollBar.GetChildAt(0);
        for(var i = 0; i < Math.abs(horizontal); i++)
        {
            button._DoClick();
        }
    }

    var vScrollBar = grid.GetNextSibling();
    if (vScrollBar.GetTypeName() == "ScrollBar")
    {
        var vScrollHeight = vScrollBar.GetHeight();
        for(var i = 0; i < Math.abs(vertical); i++)
        {
            if (vertical > 0)
            {
                vScrollBar._DoClick(undefined, vScrollHeight - 10);
            }
            else
            {
                vScrollBar._DoClick(undefined, 10);
            }
        }
    }
    
    return true;
}

 

Article Info
  • Last Updated: 8/23/2018
  • Article ID: KB343
  • Views: 351