This is a migrated thread and some comments may be shown as answers.

how to indentify the active page?

5 Answers 194 Views
ScrollView
This is a migrated thread and some comments may be shown as answers.
Laurent
Top achievements
Rank 2
Iron
Iron
Laurent asked on 27 Feb 2019, 02:53 PM

Hi,

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

 

Best regards,

 

Laurent.

5 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 28 Feb 2019, 01:01 PM
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.
0
Laurent
Top achievements
Rank 2
Iron
Iron
answered on 28 Feb 2019, 02:37 PM

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.

0
Alex Hajigeorgieva
Telerik team
answered on 04 Mar 2019, 01:05 PM
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.
0
Laurent
Top achievements
Rank 2
Iron
Iron
answered on 05 Mar 2019, 09:40 AM

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.

 

0
Accepted
Alex Hajigeorgieva
Telerik team
answered on 07 Mar 2019, 10:03 AM
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.
Tags
ScrollView
Asked by
Laurent
Top achievements
Rank 2
Iron
Iron
Answers by
Konstantin Dikov
Telerik team
Laurent
Top achievements
Rank 2
Iron
Iron
Alex Hajigeorgieva
Telerik team
Share this question
or