pull/104/head
cagataycivici 2019-11-18 17:06:16 +03:00
parent eda8b0ccf6
commit 211ed1ba5a
3 changed files with 11 additions and 11 deletions

View File

@ -1520,7 +1520,7 @@ export default {
}, },
dataToRender() { dataToRender() {
const data = this.processedData; const data = this.processedData;
if (data && this.paginator) { if (data && this.paginator) {
const first = this.lazy ? 0 : this.d_first; const first = this.lazy ? 0 : this.d_first;
return data.slice(first, first + this.d_rows); return data.slice(first, first + this.d_rows);

View File

@ -55,7 +55,7 @@ export default {
}, },
mounted() { mounted() {
this.setScrollHeight(); this.setScrollHeight();
if (!this.frozen) if (!this.frozen)
this.alignScrollBar(); this.alignScrollBar();
else else
@ -76,12 +76,12 @@ export default {
if (frozenView) { if (frozenView) {
frozenScrollBody = DomHandler.findSingle(frozenView, '.p-datatable-scrollable-body'); frozenScrollBody = DomHandler.findSingle(frozenView, '.p-datatable-scrollable-body');
} }
this.$refs.scrollHeaderBox.style.marginLeft = -1 * this.$refs.scrollBody.scrollLeft + 'px'; this.$refs.scrollHeaderBox.style.marginLeft = -1 * this.$refs.scrollBody.scrollLeft + 'px';
if( this.$refs.scrollFooterBox) { if( this.$refs.scrollFooterBox) {
this.$refs.scrollFooterBox.style.marginLeft = -1 * this.$refs.scrollBody.scrollLeft + 'px'; this.$refs.scrollFooterBox.style.marginLeft = -1 * this.$refs.scrollBody.scrollLeft + 'px';
} }
if(frozenScrollBody) { if(frozenScrollBody) {
frozenScrollBody.scrollTop = this.$refs.scrollBody.scrollTop; frozenScrollBody.scrollTop = this.$refs.scrollBody.scrollTop;
} }
@ -93,19 +93,19 @@ export default {
let virtualTableHeight = DomHandler.getOuterHeight(this.virtualScroller); let virtualTableHeight = DomHandler.getOuterHeight(this.virtualScroller);
let pageCount = (virtualTableHeight / pageHeight)||1; let pageCount = (virtualTableHeight / pageHeight)||1;
let scrollBodyTop = this.scrollTable.style.top||'0'; let scrollBodyTop = this.scrollTable.style.top||'0';
if(this.scrollBody.scrollTop + viewport > parseFloat(scrollBodyTop) + tableHeight || this.scrollBody.scrollTop < parseFloat(scrollBodyTop)) { if(this.scrollBody.scrollTop + viewport > parseFloat(scrollBodyTop) + tableHeight || this.scrollBody.scrollTop < parseFloat(scrollBodyTop)) {
if (this.loadingTable) { if (this.loadingTable) {
this.loadingTable.style.display = 'table'; this.loadingTable.style.display = 'table';
this.loadingTable.style.top = this.scrollBody.scrollTop + 'px'; this.loadingTable.style.top = this.scrollBody.scrollTop + 'px';
} }
let page = Math.floor((this.scrollBody.scrollTop * pageCount) / (this.scrollBody.scrollHeight)) + 1; let page = Math.floor((this.scrollBody.scrollTop * pageCount) / (this.scrollBody.scrollHeight)) + 1;
if(this.props.onVirtualScroll) { if(this.props.onVirtualScroll) {
this.props.onVirtualScroll({ this.props.onVirtualScroll({
page: page page: page
}); });
this.virtualScrollCallback = () => { this.virtualScrollCallback = () => {
if (this.loadingTable) { if (this.loadingTable) {
this.loadingTable.style.display = 'none'; this.loadingTable.style.display = 'none';
@ -127,7 +127,7 @@ export default {
let relativeHeight = DomHandler.getOuterHeight(datatableContainer.parentElement) * parseInt(this.scrollHeight, 10) / 100; let relativeHeight = DomHandler.getOuterHeight(datatableContainer.parentElement) * parseInt(this.scrollHeight, 10) / 100;
let staticHeight = containerHeight - 100; //total height of headers, footers, paginators let staticHeight = containerHeight - 100; //total height of headers, footers, paginators
let scrollBodyHeight = (relativeHeight - staticHeight); let scrollBodyHeight = (relativeHeight - staticHeight);
this.$refs.scrollBody.style.height = 'auto'; this.$refs.scrollBody.style.height = 'auto';
this.$refs.scrollBody.style.maxHeight = scrollBodyHeight + 'px'; this.$refs.scrollBody.style.maxHeight = scrollBodyHeight + 'px';
this.$refs.scrollBody.style.visibility = 'visible'; this.$refs.scrollBody.style.visibility = 'visible';
@ -142,7 +142,7 @@ export default {
}, },
alignScrollBar() { alignScrollBar() {
let scrollBarWidth = this.hasVerticalOverflow() ? DomHandler.calculateScrollbarWidth() : 0; let scrollBarWidth = this.hasVerticalOverflow() ? DomHandler.calculateScrollbarWidth() : 0;
this.$refs.scrollHeaderBox.style.marginRight = scrollBarWidth + 'px'; this.$refs.scrollHeaderBox.style.marginRight = scrollBarWidth + 'px';
if (this.$refs.scrollFooterBox) { if (this.$refs.scrollFooterBox) {
this.$refs.scrollFooterBox.style.marginRight = scrollBarWidth + 'px'; this.$refs.scrollFooterBox.style.marginRight = scrollBarWidth + 'px';

View File

@ -42,7 +42,7 @@
</tbody> </tbody>
</template> </template>
<script> <script>
import ObjectUtils from '../utils/ObjectUtils'; import ObjectUtils from '../utils/ObjectUtils';
import BodyCell from './BodyCell.vue'; import BodyCell from './BodyCell.vue';