Using a Slider Control to Scroll a List


Say you have a List control and you want to put a Slider control under the List to scroll the List. Assume that the name of the Slider control is 'Slider1'.

  1. Put this code in the List's AfterRenderComplete event

    var s = {dialog.object}.getControl('Slider1');
    var l = {dialog.object}.getControl('{dialog.listId}');
    s.min = 0;
    s.max = (l._data.length -1);
    This code sets the min/max values on the slider to match the row count of the List.
  2. Put this code in the Slider control's onSlide event:

    var l = {dialog.object}.getControl('LIST1');
    //the value of the slider while it is being dragged is in arguments[0].value
    var val = arguments[0].value