all files / components/ VuetablePaginationDropdown.vue

42.86% Statements 6/14
100% Branches 4/4
12.5% Functions 1/8
20% Lines 2/10
1 branch Ignored     
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76                                                                                                                                                     
// <template>
//   <div :class="[css.wrapperClass]">
//     <a @click="loadPage('prev')"
//        :class="[css.linkClass, isOnFirstPage ? css.disabledClass : '']">
//       <i :class="icons.prev"></i>
//     </a>
//     <select :class="[{'vuetable-pagination-dropdown': true}, dropdownClass]" @change="selectPage($event)">
//       <option v-for="n in totalPage" :class="[css.pageClass]" :value="n" :selected="isCurrentPage(n)">
//         {{pageText}} {{n}}
//       </option>
//     </select>
//     <a @click="loadPage('next')"
//        :class="[css.linkClass, isOnLastPage ? css.disabledClass : '']">
//       <i :class="icons.next"></i>
//     </a>
//   </div>
// </template>
//
// <script>
import PaginationMixin from './VuetablePaginationMixin.vue'
 
export default {
  mixins: [PaginationMixin],
  props: {
    dropdownClass: {
      type: String,
      default () {
        return 'ui search dropdown'
      }
    },
    pageText: {
      type: String,
      default () {
        return 'Page'
      }
    }
  },
  methods: {
    loadPage (page) {
      // update dropdown value
      // if (page == 'prev' && !this.isOnFirstPage) {
      //   this.setDropdownToPage(this.tablePagination.current_page-1)
      // } else if (page == 'next' && !this.isOnLastPage) {
      //   this.setDropdownToPage(this.tablePagination.current_page+1)
      // }
 
      this.$emit('vuetable-pagination:change-page', page)
    },
    // setDropdownToPage (page) {
    //   this.$nextTick( () => {
    //     let el = document.getElementById('vuetable-pagination-dropdown')
    //     if (el) {
    //       el.value = page
    //     }
    //   })
    // },
    selectPage (event) {
      this.$emit('vuetable-pagination:change-page', event.target.selectedIndex+1)
    },
    registerEvents () {
      let self = this
 
      this.$on('vuetable:pagination-data', (tablePagination) => {
        self.setPaginationData(tablePagination)
      })
    }
  },
  created () {
    this.registerEvents()
  }
}
// </script>
 
/* generated by vue-loader */