After an extensive search through StackOverflow and SlickGrid docs, I didn't find a way to set the grid Pager automatically to "auto" at grid init. The solution I found is to modify slick.pager.js at line 70 adding id='autopager' in:

$settings.append(
"<span class='slick-pager-settings-expanded' style='display:none'>Show:
<a data=0>All</a><a data='-1' id='autopager'>Auto</a><a data=25>25</a>
<a data=50>50</a><a data=100>100</a></span>");

So I can trigger che "click" event on the "auto" link in the pager with one line of code: $('#autopager').trigger('click');

It works well for me and maybe it could be useful for others. There is some better solution not involving hacking the core of SlickGrid?

有帮助吗?

解决方案

You could try below code. But it will be the fixed value for pageSize.

data_view.setPagingOptions({pageSize: 20})
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top