FoxInCloud
Scrolling a grid
Gravatar is a globally recognized avatar based on your email address. Scrolling a grid
  Paul
  All
  Apr 4, 2019 @ 03:43am

Hi,

I have two images and when the user clicks on them (actually, the mousedown event) I want to scroll a grid up and down; this is suitable for a touchscreen, where a scrollbar is too small.
I return this JS in the mousedown event, but the grid does not scroll :

var scrollTop = jQuery('#stockcontrolcheckarea-mfgscrollbuttons2-downbutton').getScrollTop();  
jQuery('#stockcontrolcheckarea-mfgscrollbuttons2-downbutton').setScrollTop(scrollTop + 50);  
jQuery('#stockcontrolcheckarea-mfgscrollbuttons2-downbutton').raiseEvent("onScrollTopChanged");  

I know the JS is being triggered, as I can put an alert() call in there and that works, but I may not have the right code for the Active Widgets grid.
Do you know the code to scroll the grid?

Also, I don't want any scrollbars - the AW grid has a vertical scrollbar, even when the Foxpro grid is defined to have no scrollbars. Do I have to use more JS to stop the grid in the browser from having a scrollbar?

Thanks
Paul

Gravatar is a globally recognized avatar based on your email address. re: Scrolling a grid
  FoxInCloud Support - Thierry N.
  Paul
  Apr 4, 2019 @ 07:17am

Hi Paul, here is a sample code

procedure grd.wcHTMLgen
lparameters toHTMLgen, …

toHTMLgen.cScriptJSAdd(textmerge([jQuery("#<<this.wcID>>").prop('oGrid').setScrollProperty('bars', 'none')]))


procedure cmd.mouseDown
lparameters …

if thisForm.wlHTMLgen
 local cScript
 text to cScript textmerge noshow flag 1 pretext 15
  var oGrid = jQuery("#<<this.Parent.grd.wcID>>").prop('oGrid');
  oGrid.setScrollProperty('top', oGrid.getScrollProperty('top') + 10);
 endtext
 return m.cScript
endif
Gravatar is a globally recognized avatar based on your email address. re: Scrolling a grid
  Paul
  FoxInCloud Support - Thierry N.
  Apr 4, 2019 @ 03:03pm

Aaaaah, SetScrollProperty(). I couldn't see much about that on the AW web site. Thanks Thierry.
Now to discover how to continue scrolling while holding your finger down on the image...

btw
I added this code into the base class of my grid's wcHTMLgen(), I think it might be useful to include something like it as standard in FiC :

If this.ScrollBars != SCROLLBARS_BOTH  
    toHTMLgen.cScriptJSAdd_(textmerge([jQuery("#<<this.wcID>>").prop('oGrid').setScrollProperty('bars', '] + ;  
        Icase(this.ScrollBars = SCROLLBARS_NONE, "none", ;  
                this.ScrollBars = SCROLLBARS_HORIZONTAL, "horizontal", ;  
                this.ScrollBars = SCROLLBARS_VERTICAL, "vertical") + ;  
        [');] + ;  
        [ jQuery("#<<this.wcID>>").prop('oGrid').onScrollBarsChanging = function(){return 1};]))  
endif  

Notes :

  1. just guessing at "horizontal" and "vertical", have not tested it
  2. use cScriptJSAdd_() to add the script **after ** the usual FiC script
  3. use onScrollBarsChanging () to prevent the scrollbars from reappearing after the recordsource is assigned at runtime

Does wcHTMLgen() need to contain a =dodefault() ?

Paul

Gravatar is a globally recognized avatar based on your email address. re: Scrolling a grid
  FoxInCloud Support - Thierry N.
  Paul
  Apr 5, 2019 @ 01:23am

Hi Paul,

You found what looks very much like a glitch in ActiveWidgets

FoxInCloud does take care of .scrollBars be generating this JavaScript:

oGrid.setScrollBars('<<ICase(m.luProp=0,"none",m.luProp=1,"horizontal",m.luProp=2,"vertical","both")>>')

ActiveWidgets grid respects this setting but seems to revert to automatic scrollbars (default setting) after loading the data.

Alex from ActiveWidgets should soon help us find a workaround.

Does your code also work when later refreshing the grid data?

© 1996-2019