Tuesday 18 December 2018

Bringing Back Scrolling in list Applet

Hello All,

In this post i will share one of the enhancement or probably i should call it fix for enabling scrolling which was a very useful feature in Siebel HI.

In Open UI we have now navigation controls in bottom of applet In IP 13 to IP 16, we have below controls
  • Next Record
  • Previous Record 
  • Next Record Set
  • Previous Record Set
In IP17 onwards there is change in navigation controls, now there is no option of Next and Previous record in list applet, we now have


  • Next Record Set
  • Previous Record Set
  • Last Record Set
  • First Record Set

Now with the below code we can use the record navigation from Mouse scrolling , 
  • Scroll down to go to Next record Set 
  • Scroll up to go to Previous Record Set.

Lets try to understand the things we need to get the things Working 
  • Bind Mouse Scroll event , to let Siebel know that it has to do something on mouse scrolling
$(appletPlaceHolder).bind('mousewheel', function(e){}
  • Check for Up/Down Scrolling, to perform forward or backward navigation (this code is standard HTML 5 code )

 if(e.originalEvent.wheelDelta /120 > 0) {
        console.log('scrolling up !');
else 
        console.log('scrolling Down!');}
  • Call method for Navigation , method called for fetching next records is GotoNextSet and for moving to previous record is GotoPreviousSet. We need to call this method based on Scrolling directions
if(pm.ExecuteMethod("CanInvokeMethod", "GotoNextSet"))
{
pm.ExecuteMethod("InvokeMethod","GotoNextSet",null,false);
}

Note : We could have directly written  pm.ExecuteMethod("InvokeMethod","GotoNextSet",null,false) , but i have used if statement and check for CanInvokeMethod to prevent error which will appear in case of scrolling even if we have reached last record set or First record set

Final Code




$(appletPlaceHolder).bind('mousewheel', function(e){
        if(e.originalEvent.wheelDelta /120 > 0) {
            console.log('scrolling up !');
            e.preventDefault(); // to prevent default browser scrolling
//to prevent unnecessary pop ups using canInvoke first 
if(pm.ExecuteMethod("CanInvokeMethod", "GotoNextSet")){
pm.ExecuteMethod("InvokeMethod","GotoNextSet",null,false); }
 }
        else
       {
            console.log('scrolling down !');
            e.preventDefault(); // to prevent default browser scrolling
                 //to prevent unnecessary pop ups using canInvoke first 
if(pm.ExecuteMethod("CanInvokeMethod", "GotoPreviousSet")){
pm.ExecuteMethod("InvokeMethod","GotoPreviousSet",null,false);}
        }
    });

Downloadable link to PR file https://drive.google.com/open?id=15LPuMOgDNBvQju-S1KoX5ePi6yJTBPAH

try it, your comment and suggestions are always welcome



1 comment:

  1. Hi. Just a note. Scrolling the mouse wheel repeatedly could cause more pain than simply holding the mouse button down on the next set or previous set buttons.

    ReplyDelete

Siebel GoTo View - Handling Realtime cases

 Hello All,  We all must have used GoTo view functionality of siebel to navigate to a particular view from current view. What if the require...