Привет. Проведя много исследований и разработок, я нашел одно решение. т.е. vuetify в Vue js. Это работает как чары. Я добавил 50000 строк, и он рендерится за 4 c. вы можете увеличить объем данных до 500000 и это вряд ли займет 10 сек c. Как видите, текущая сложность рендеринга данных составляет 50000 * 300
"use strict";
var d = new Vue({
el: '#app',
vuetify: new Vuetify(),
data: function data() {
return {
items: [],
drpItems: [],
itemsPerPage: 0,
optionsLength: 6,
loading: true,
footerProps: {
'items-per-page-options': [10, 20, 50, 100, 1000]
},
headers: [{
text: 'ID',
value: 'id'
}, {
text: 'Description',
value: 'description'
}, {
text: 'QTY1',
value: 'qty1'
}, {
text: 'QTY2',
value: 'qty2'
}, {
text: 'Qty3',
value: 'qty3'
}],
customer: {
name: 'customer',
items: []
}
};
},
created: function created() {
this.initialize();
var self = this;
window.onresize = function (event) {
self.updateTable();
};
},
methods: {
updateTable: function updateTable() {
var tableHeight = document.getElementById('dataTable').offsetHeight;
this.itemsPerPage = parseInt(tableHeight / 40);
if (this.customer.items.length < this.itemsPerPage) this.itemsPerPage = this.customer.items.length;
if (!this.footerProps['items-per-page-options'].includes(this.itemsPerPage)) {
if (this.footerProps['items-per-page-options'].length == this.optionsLength) {
this.footerProps['items-per-page-options'].unshift(this.itemsPerPage);
} else {
this.footerProps['items-per-page-options'].shift();
this.footerProps['items-per-page-options'].unshift(this.itemsPerPage);
}
}
},
initialize: function initialize() {
var self=this;
for (var i = 0; i < 300; i++) {
this.drpItems.push("mukesh" + i);
}
for (var i = 0; i < 50000; i++) {
var obj = {
id: i,
description: 'ABC',
qty1: '',
qty2: 'mukesh14',
qty3: 'mukesh1'
};
obj.drpItems = [];
this.customer.items.push(obj);
} // deep copy is the solution
// const items = JSON.parse(JSON.stringify(this.customer.items))
this.items = this.customer.items;
setTimeout(function(){ self.loading=false;},1500);
}
}
});
<script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.js"></script>
<link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" type="text/css" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" type="text/css" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@3.x/css/materialdesignicons.min.css" type="text/css" rel="stylesheet" />
<style>
#dataTable .v-table tbody tr:not(:last-child) {
border-bottom: none;
}
#dataTable th{
font-size:16px;
color:"black"
}
.v-data-table__wrapper{
border:1px solid;
}
</style>
<v-data-table
must-sort
:headers="headers"
:pagination.sync="pagination"
:rows-per-page-items="pagination.rowsPerPageItems"
:total-items="pagination.totalItems"
:loading="loading"
:items="items"
class="elevation-1"
>
<div id="app">
<div>
<v-app>
<v-main>
<v-container>
<v-data-table id="dataTable" dense
:headers="headers"
:items="items"
:rows-per-page="itemsPerPage"
:footer-props="footerProps"
:loading="loading" loading-text="Loading... Please wait"
>
</template>
<template v-slot:item.qty1="props">
<v-text-field v-model="props.item.qty1"></v-text-field>
</template>
<template v-slot:item.qty2="props">
<v-select
:items="drpItems"
label="Standard"
v-model="props.item.qty2"
:value="props.item.qty2"
></v-select>
</template>
<template v-slot:item.qty3="props">
<v-select
:items="drpItems"
label="Standard"
:value="props.item.qty3"
v-model="props.item.qty3"></v-select>
</template>
</v-data-table>
</v-container>
</v-main>
</v-app>
</div>
</div>