diff --git a/README.md b/README.md index 1479383..cab2c14 100644 --- a/README.md +++ b/README.md @@ -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, }); diff --git a/README.zh.md b/README.zh.md index 030e429..5f3e44a 100644 --- a/README.zh.md +++ b/README.zh.md @@ -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, }); diff --git a/package.json b/package.json index 0f7a3a6..a45e221 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/components/table/table-head.vue b/src/components/table/table-head.vue index 67bbcd4..879469c 100644 --- a/src/components/table/table-head.vue +++ b/src/components/table/table-head.vue @@ -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); diff --git a/src/components/table/table.vue b/src/components/table/table.vue index afe65c0..c9e7385 100644 --- a/src/components/table/table.vue +++ b/src/components/table/table.vue @@ -199,7 +199,7 @@ -
+
= 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 = []; @@ -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() { @@ -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() {