Disable wheel scrolling only

I need to disable the mouse wheel scrolling event for the grid, but keeping the other scrolling events.

Some external functions are based on the scrolling event of the grid, so I need to keep the following code:
          dataBound: function (args) {
            var scroll = this.getScrollObject();
            var scrollEvt = scroll.model.scroll;
            //console.log(scrollEvt.source);  
            scroll.model.scroll = function (e) {
              scrollEvt.apply(this, [e]);
              if(e.source=='wheel'){
                console.log('wheel scrolling', e);
                // Disable only the scroll generated by the mouse wheel movements
                e.cancel=true;
              }
              else{
                console.log('Scrolling with ' + e.source);
                //If the user scroll with button or thumb or by dragging the handler, 
                // I need to perform some operations based on the handle bar position.
              }
            }
          }

but I don't want the grid to scroll on wheel movements.

I've tried to disable with javascript at DOM level but it doesn't work.


thanks!

3 Replies

FS Farveen Sulthana Thameeztheen Basha Syncfusion Team January 9, 2018 03:51 PM UTC

Hi Marco, 

Thanks for contacting Syncfusion Support. 

We have achieved your requirement disable the mouse wheel scrolling using “create” event of the Grid.  In the create event of the Grid. In the create event of the Grid, we have get the scroll Object and restricted the mouse wheel scroll functionality and keeping the other scrolling events. 

Please refer to the code example:- 

$(document).ready(function () { 
   $("#grid").ejGrid({ 
        dataSource: progAct.typicalYear.data, 
         create: function (args) { 
            var scroll = this.getScrollObject(); 
            scroll._off(scroll.element, scroll._browser == "msie" ? "wheel mousewheel" : "mousewheel DOMMouseScroll", scroll._mouseWheel); 
             
           }, 
           
        }); 
 
      }); 
    </script> 


Please get back to us if you need any further assistance. 

Regards, 

Farveen sulthana T 



MG Marco Giorgi January 9, 2018 04:28 PM UTC

what to say... many many thanks!
It works like a charm

Best,
Marco


PK Prasanna Kumar Viswanathan Syncfusion Team January 10, 2018 05:40 AM UTC

Hi Marco, 

We are happy to hear that your issue has been resolved. 

Please let us know if you need any further assistance. 

Regards, 
Prasanna Kumar N.S.V 


Loader.
Up arrow icon