On client side (there is no server side) we have html file with javascript which we are open in browser. In HTML file we include bootstrap and select2 plugins to create UI interface and we include one file with data which have more than 10 000 rows. This is part of basic.html file:
....
<select class="js-example" name="selectmyData[]" id="selectmyData" multiple="multiple"></select>
<script src="data/mydata.js"><script>
<script type="text/javascript">
$(document).ready(function() {
$(".js-example").select2({
tags: true,
data: mydata
})
});
</script>
...
This is part of mydata.js file:
var mydata = [{id: 0, text: "aa"}, ..... ...... {id: 10000, text: "aa 10000"}];
Question: Because variable mydata is very big, we have bad responsive time when we are selecting data. How can we restrict Select2 plugin to initially select only 10 rows on begining (initially when we load the script) and every time when trying to find some data? On the other words, results for showing must be limited.
There are no server side, no ajax, no (my)sql server, no any other programing language, only html, javascript and bootstrap5 with select2 plugin.