how to indentify the active page?

6 posts, 1 answers
  1. Laurent
    Laurent avatar
    13 posts
    Member since:
    Apr 2017

    Posted 27 Feb Link to this post

    Hi,

    How to know what is the active page in a scrollview when initialized from HTML ?

     

    Best regards,

     

    Laurent.

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2466 posts

    Posted 28 Feb Link to this post

    Hello Laurent,

    You could try to use the "index" method for the focused dot in the pager:
    var scrollview = $("#scrollView").data("kendoScrollView");
    var pageIndex = scrollview.pager.element.find(".k-primary").index();

    Hope this helps.


    Regards,
    Konstantin Dikov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Laurent
    Laurent avatar
    13 posts
    Member since:
    Apr 2017

    Posted 28 Feb in reply to Konstantin Dikov Link to this post

    Hi Konstantin,

    Thank you for your prompt response.

    The fact is that I don't want to use the pager !

    Another point: the destroy() method fails (raising error) when enablePager is false. It works with the pager enabled but then all the content of the scrollview is discarded from the DOM, which seems to be bad for me !

    Any clue ?

     

    Laurent.

  4. Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    768 posts

    Posted 04 Mar Link to this post

    Hello, Laurent,

    If you want to get the current page without using a pager, you could use the page position. Only the current page would have left 0.

    function getCurrentPage(){
      var currentPage = $("[data-role='page']").filter(function(idx, elem){ return !$(elem).position().left; });
      kendo.alert("Current Page is: " + currentPage.text());
    }

    https://dojo.telerik.com/@bubblemaster/OlaDaNuH

    As far as the pager is concerned, thank you for bringing this error to our attention.

    To avoid it you may override the destroy function before the widget is initialized while we have the issue logged and fixed:

    kendo.ui.ScrollView.fn.destroy = function(){
       kendo.ui.Widget.fn.destroy.call(this);
       this._content.destroy();
       this.pane.destroy();
    if(this.pager){
         this.pager.destroy();
       }               
       this.inner = null;
       kendo.destroy(this.element);
     }

    I will get back to you tomorrow with more information about the issue. 

    Kind Regards,
    Alex Hajigeorgieva
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  5. Laurent
    Laurent avatar
    13 posts
    Member since:
    Apr 2017

    Posted 05 Mar in reply to Alex Hajigeorgieva Link to this post

    Hi Alex,

    Thank you for the workaround. It would be simplier to have a sort of page() method to get the current page!

    About destroy() and the fact that the data-role=page content is removed from the DOM ? Is it considered as a normal behaviour ?

    A last thing: it seems impossible to initialise the widget correctly with a <div id="scrollView"> hidden by default. Would be an interesting possiblity.

     

    Best regards,

    Laurent.

     

  6. Answer
    Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    768 posts

    Posted 07 Mar Link to this post

    Hi, Laurent,

    I have now logged this issue in our public repository and you may subscribe to it if you wish to watch its progress:

    https://github.com/telerik/kendo-ui-core/issues/4890

    I have also added some Telerik points to your account as a token o appreciation or helping us improve the Kendo UI ScrollView:

    https://www.telerik.com/community/telerik-points

    As far as the page() method suggestion, I have logged a Feature Request in the Kendo UI feedback portal on your behalf:

    https://feedback.telerik.com/kendo-jquery-ui/1399295-implement-a-page-method-for-the-scrollview

    The more votes it gets, the sooner it will get into our current workload.

    Additionally, hidden containers are known to create issues or scrollable elements and calculations of height specifically. Using the approach described in this section of the documentation should remedy any issues:

    https://docs.telerik.com/kendo-ui/controls/data-management/grid/appearance/hidden-containers

    Finally, the question of whether it is normal to remove the content data-role="page" on destroying, yes, it is and it is described in the API:

    https://docs.telerik.com/kendo-ui/api/javascript/ui/scrollview/methods/destroy

    Regards,
    Alex Hajigeorgieva
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top