Code Monkey home page Code Monkey logo

vue-floatthead's Introduction

Build Status

vue-floatthead

Vue 2 component for jquery.floatThead

Installation

npm

$ npm install vue-floatthead

Getting Started

<template>
  <float-thead-table>
    <thead>
      <tr>
          <th><a href="#" id="demoHeader1">xclick me</a></th>
          <th><a href="#" id="demoHeader2">mouse over me</a></th>
          <th><a href="#" id="demoHeader3">Header...3</a></th>
      </tr>
      <tbody>
        <tr>
            <td>Cell Content 1</td>
            <td>Cell Content 2</td>
            <td>Cell Content 3</td>
        </tr>
      </tbody>
    </thead>
  </float-thead-table>
</template>

<script>
  import Vue from 'vue'
  import FloatThead from 'vue-floatthead'

  Vue.use(FloatThead)

  export default {
    components: {
      FloatThead
    }
  }
</script>

Usages

Pass options to the component

<float-thead-table position='fixed' floatTableClass='awesome-table'></float-thead-table>

Call methods of the component destroy(), reflow(), or getRowGroups()

<float-thead-table ref='awesometable'></float-thead-table>

<script>
  ...
  methods: {
    triggerDestroy () {
      this.$refs.awesometable.destroy()
    }
  }
  ...
</script>

Trigger events

<script>
  ...
  mounted () {
    this.$refs.awesometable.$on('floatThead', (e, isFloated, floatContainer) =>
      console.log('floatThead triggered', e, isFloated, floatContainer)
    )
    this.$refs.awesometable.$on('reflowed', (e, floatContainer) =>
      console.log('reflowed triggered', e, floatContainer)
    )
  }
  ...
</script>

vue-floatthead's People

Contributors

psalaets avatar tmlee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vue-floatthead's Issues

dynamic table with v-for

Hi and thank you for the component. Should the component also work if the table gets built from (async) from the data of a component? I dont get it working with

<th v-for="....">head</th>

Floating when shouldn't

I feel like I must be missing something here but please see the linked video

https://youtu.be/-QpPF-Lvaf4

It seems like the header is floating when it shouldn't be. But I'm unclear from looking at your code and documentation what I'm doing wrong to cause this


         <float-thead-table class="developer-table" position='fixed' :debug="true">
          <thead class="sticky-head">
            <tr class="table-top-header">
              <th class="blank-header developer"></th>
              <th class="divider"></th>
              <th colspan=7 class="settings-header">Persistent Settings</th>
              <th class="divider"></th>
              <th colspan=10 class="status-header">{{monthYear}} Status</th>
            </tr>
            <tr>
              <th class="developer sortable" :class="isSortProperty('developer_name')" @click="sortBy('developer_name')">Developer</th>
              <th class="divider"></th>
              <th class="center sortable toggle-column" :class="isSortProperty('pdf_setting')" @click="sortBy('pdf_setting')">PDF</th>
              <th class="center sortable toggle-column" :class="isSortProperty('xero_setting')" @click="sortBy('xero_setting')">Xero</th>
              <th class="center sortable toggle-column" :class="isSortProperty('payment_setting')" @click="sortBy('payment_setting')">Payment</th>
              <th class="center sortable toggle-column" :class="isSortProperty('email_setting')" @click="sortBy('email_setting')">Email</th>
              <th class="sortable recipients-column" :class="isSortProperty('recipients')" @click="sortBy('recipients')">Recipients</th>
              <th class="sortable" :class="isSortProperty('notes_setting')" @click="sortBy('notes_setting')">Notes</th>
              <th>Save</th>
              <th class="divider"></th>
              <th class="center sortable" :class="isSortProperty('pdf')" @click="sortBy('pdf')">PDF</th>
              <th class="center sortable" :class="isSortProperty('xero')" @click="sortBy('xero')">Xero</th>
              <th class="center sortable" :class="isSortProperty('payment')" @click="sortBy('payment')">Payment</th>
              <th class="center sortable" :class="isSortProperty('email')" @click="sortBy('email')">Email</th>
              <th class="center sortable" :class="isSortProperty('processed')" @click="sortBy('processed')">Processed</th>
              <th class="center sortable" :class="isSortProperty('cad_value')" @click="sortBy('cad_value')">CAD</th>
              <th class="center sortable" :class="isSortProperty('usd_value')" @click="sortBy('usd_value')">USD</th>
              <th class="center sortable" :class="isSortProperty('reviewed')" @click="sortBy('reviewed')">Memo</th>
              <th class="center sortable" :class="isSortProperty('notes')" @click="sortBy('notes')">Notes</th>
              <th class="center">Edit</th>
            </tr>
          </thead>

          <tbody>
            <DeveloperRow
              v-for="(developer, index) in developers"
              :key="developer.game_developer_id"
              :index="index"
              :developer="developer"
              :monthYear="monthYear"
              :ref="developer.game_developer_id"
              v-on:error="onError"
              v-on:preview-pdf="preview"
              v-on:edit-note="editNotes"
            />
          </tbody>
        <!-- </table> -->
        </float-thead-table>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.