Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/jiahengaa/BeeGridTable into…
Browse files Browse the repository at this point in the history
… main

# Conflicts:
#	src/components/table/table-head.vue
  • Loading branch information
jiahengaa committed Nov 6, 2020
2 parents e9104a1 + 6cfa0a4 commit 6bae48c
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 16 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,13 @@ import router from "./router";
import store from "./store";
import BeeGridTable from "beegridtable";
import BeeLocale from "beegridtable/src/locale";
//import BeeLocale from "beegridtable/src/locale"; //default English
import BeelocaleZh from 'beegridtable/src/locale/lang/zh-CN' // Set zh-CN default
import 'beegridtable/dist/styles/beegridtable.css';
Vue.use(BeeGridTable, {
BeeLocale,
locale:BeelocaleZh,
capture: true,
});
Expand Down
7 changes: 5 additions & 2 deletions README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,13 @@ import router from "./router";
import store from "./store";
import BeeGridTable from "beegridtable";
import BeeLocale from "beegridtable/src/locale";
//import BeeLocale from "beegridtable/src/locale"; //默认为英语
import BeelocaleZh from 'beegridtable/src/locale/lang/zh-CN' // 设置中文为默认语言
import 'beegridtable/dist/styles/beegridtable.css';
Vue.use(BeeGridTable, {
BeeLocale,
locale:BeelocaleZh, //此处必须这样写
capture: true,
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "beegridtable",
"version": "1.0.2",
"version": "1.1.2",
"title": "BeeGridTable",
"description": "A high quality DataTable component Library with Vue.js",
"homepage": "http://www.beegridtable.com",
Expand Down
1 change: 0 additions & 1 deletion src/components/table/table-head.vue
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,6 @@ export default {
e.data.replace(/(^\s*)|(\s*$)/g, "").length == 0
) {
fcolumn.filterValue = fcolumn._filterValue;
this.$parent.doSortAndFilter(null, fcolumn);
} else {
this.onInputEvt(e, fcolumn);
Expand Down
68 changes: 58 additions & 10 deletions src/components/table/table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
<slot name="footer"></slot>
</div>

<div style="margin-top: 15px">
<div style="margin-top: 15px" v-if="showPager">
<Page
show-total
:filterResultL="localeFilterResultL"
Expand Down Expand Up @@ -397,6 +397,10 @@ export default {
resetFilter: {
type: String,
},
showPager: {
type: Boolean,
default: true,
},
},
data() {
return {
Expand Down Expand Up @@ -547,12 +551,20 @@ export default {
}
if (this.height) {
let height = parseInt(this.height) + summaryHeight;
style.height = `${height + pageRowHeight}px`;
if (this.showPager) {
style.height = `${height + pageRowHeight}px`;
} else {
style.height = `${height}px`;
}
}
if (this.maxHeight) {
const maxHeight =
parseInt(this.maxHeight) + summaryHeight + pageRowHeight;
style.maxHeight = `${maxHeight + pageRowHeight}px`;
if (this.showPager) {
style.maxHeight = `${maxHeight + pageRowHeight}px`;
} else {
style.maxHeight = `${maxHeight}px`;
}
}
if (this.width) style.width = `${this.width}px`;
return style;
Expand Down Expand Up @@ -616,6 +628,7 @@ export default {
},
bodyStyle() {
let style = {};
if (this.bodyHeight !== 0) {
const height = this.bodyHeight;
if (this.height) {
Expand Down Expand Up @@ -745,11 +758,16 @@ export default {
this.getRenderData();
},
getRenderData() {
var skipNum = (this.currentIndex - 1) * this.currentSize;
this.renderData =
skipNum + this.currentSize >= this.rebuildData.length
? this.rebuildData.slice(skipNum, this.rebuildData.length)
: this.rebuildData.slice(skipNum, skipNum + this.currentSize);
if (this.showPager) {
var skipNum = (this.currentIndex - 1) * this.currentSize;
this.renderData =
skipNum + this.currentSize >= this.rebuildData.length
? this.rebuildData.slice(skipNum, this.rebuildData.length)
: this.rebuildData.slice(skipNum, skipNum + this.currentSize);
} else {
this.renderData = this.rebuildData;
}
},
makeFilterRows(tempColRows) {
let hRows = [];
Expand Down Expand Up @@ -1359,8 +1377,12 @@ export default {
this.rebuildDataStr = JSON.stringify(
this.makeDataWithSortAndFilter(sender, column)
);
this.$refs.page.currentPage = 1;
this.currentIndex = 1;
if (this.showPager) {
this.$refs.page.currentPage = 1;
this.currentIndex = 1;
}
this.getRenderData();
},
makeObjData() {
Expand Down Expand Up @@ -1495,6 +1517,32 @@ export default {
if (!this.context) this.currentContext = this.$parent;
this.showSlotHeader = this.$slots.header !== undefined;
this.showSlotFooter = this.$slots.footer !== undefined;
setTimeout(() => {
this.objData = this.makeObjData();
this.originalData = this.makeData();
this.rebuildDataStr = JSON.stringify(this.makeDataWithSortAndFilter());
if (this.rebuildData !== undefined) {
const oldDataLen = this.rebuildData.length;
if (this.$refs.page !== undefined) {
this.currentIndex = this.$refs.page.currentPage;
this.currentSize = this.$refs.page.currentPageSize;
} else {
this.currentIndex = 0;
this.currentSize = 10;
}
this.getRenderData();
// this.handleResize();
// if (!oldDataLen) {
// this.fixedHeader();
// }
} else {
console.log("undefined rebuildData!");
}
}, 0);
},
beforeMount() {
Expand Down

0 comments on commit 6bae48c

Please sign in to comment.