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

[Solved] How to set buttonCount for pager initialized via data-attributes

1 Answer 130 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 10 Nov 2014, 10:28 AM
Hi,

I've got a short question regarding MVVM, ListView and Pager:

The template contains a ListView and a Pager, both initialized via data attributes:

<div id="thumbnail-list" data-role="kendo.ui.ListView" data-bind="source:thumbs" data-template="template-thumbnails" data-source="{ 'pageSize': 52}"></div>
<
div id="pager" class="k-pager-wrap" data-role="pager" data-bind="source:thumbs, events: { change: onChange }" data-source="{ 'pageSize': 52}"></div>

Now I want to change the "buttonCount", but not quite sure how to do this. I've looked at how it works via JS initialization, but does it also work with data-attributes?

Trying to set it after initialization like this does not work:
var pager = $("#pager").data("kendoPager");
if(pager != null){  
  pager.options.buttonCount = 3;    
  pager.refresh();
}

Thanks in advance,
Patrick

1 Answer, 1 is accepted

Sort by
0
Patrick
Top achievements
Rank 1
answered on 10 Nov 2014, 01:49 PM
Found the solution.

Using the "data-button-Count" solved the problem.

Best regards,
Patrick
Tags
ListView
Asked by
Patrick
Top achievements
Rank 1
Answers by
Patrick
Top achievements
Rank 1
Share this question
or