All Projects → inlogicstudio → podtable

inlogicstudio / podtable

Licence: MIT license
No dependency responsive table library to fit large table data set into small device screen

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to podtable

Vue Good Table
An easy to use powerful data table for vuejs with advanced customizations including sorting, column filtering, pagination, grouping etc
Stars: ✭ 1,824 (+11300%)
Mutual labels:  datatable
Amexio.github.io
Amexio is a rich set of Angular 7 (170+) components powered by HTML5 & CSS3 for Responsive Design and with 80+ Material Design Themes, UI Components, Charts, Gauges, Data Point Widgets, Dashboards. Amexio is completely Open Sourced and Free. It's based on Apache 2 License. You can use it in your production grade work today at no cost or no obligation.
Stars: ✭ 163 (+918.75%)
Mutual labels:  datatable
Vuetable 2 Tutorial
Stars: ✭ 251 (+1468.75%)
Mutual labels:  datatable
Edittable
jQuery editTable is a very small jQuery Plugin (~1Kb gzipped) that fill the gap left by the missing of a default input field for data tables.
Stars: ✭ 139 (+768.75%)
Mutual labels:  datatable
Weihanli.npoi
NPOI Extensions, excel/csv importer/exporter for IEnumerable<T>/DataTable, fluentapi(great flexibility)/attribute configuration
Stars: ✭ 157 (+881.25%)
Mutual labels:  datatable
Vuetable 2
data table simplify! -- datatable component for Vue 2.x. See documentation at
Stars: ✭ 2,129 (+13206.25%)
Mutual labels:  datatable
Ka Table
Lightweight MIT React Table component for both TS and JS with Sorting, Filtering, Grouping, Virtualization, Editing and many more
Stars: ✭ 117 (+631.25%)
Mutual labels:  datatable
EasyDataTable
易用和全面的纯Ajax分页插件(中文)
Stars: ✭ 18 (+12.5%)
Mutual labels:  datatable
Primereact
The Most Complete React UI Component Library
Stars: ✭ 2,393 (+14856.25%)
Mutual labels:  datatable
Datatable
A go in-memory table
Stars: ✭ 215 (+1243.75%)
Mutual labels:  datatable
Grid
Declarative React Canvas Grid primitive for Data table, Pivot table, Excel Worksheets and more 💥
Stars: ✭ 573 (+3481.25%)
Mutual labels:  datatable
Vue Table
data table simplify! -- vuetable is a Vue.js component that will automatically request (JSON) data from the server and display them nicely in html table with swappable/extensible pagination component.
Stars: ✭ 1,833 (+11356.25%)
Mutual labels:  datatable
Vue Bootstrap4 Table
Advanced table based on Vue 2 and Bootstrap 4 ⚡️
Stars: ✭ 187 (+1068.75%)
Mutual labels:  datatable
Tui.grid
🍞🔡 The Powerful Component to Display and Edit Data. Experience the Ultimate Data Transformer!
Stars: ✭ 1,859 (+11518.75%)
Mutual labels:  datatable
au-datatable
Aurelia Datatable, A highly customizable html datatable, build for the Aurelia Framework.
Stars: ✭ 21 (+31.25%)
Mutual labels:  datatable
Vue Datatables Net
Vue jQuery DataTables.net wrapper component
Stars: ✭ 119 (+643.75%)
Mutual labels:  datatable
Django Datatable
django-datatable is a customizable table application of django based on jquery datatable.
Stars: ✭ 167 (+943.75%)
Mutual labels:  datatable
DataTableEditor
一个Unity的数据表编辑器工具
Stars: ✭ 67 (+318.75%)
Mutual labels:  datatable
ConsoleTools
A set of tools and "controls" for the .net Console.
Stars: ✭ 67 (+318.75%)
Mutual labels:  datatable
React Table
⚛️ Hooks for building fast and extendable tables and datagrids for React
Stars: ✭ 15,739 (+98268.75%)
Mutual labels:  datatable

podtable code

License Version Downloads

Podtable is a no dependency table library to fit large table dataset into smaller device screens base on the maximum squishability with various options on achieving a responsive datatable.

Preview

podtablejs

Installation

NPM

npm install podtable

CDN

https://unpkg.com/podtable@<VERSION>/dist/podtable.css
https://unpkg.com/podtable@<VERSION>/dist/podtable.js

Usage

Include podtable script

<script src="path/to/podtable.js></script>

Include podtable styles

<link rel="stylesheet" type="text/css" href="path/to/podtable.css" />

Or import podtable using the ES6 syntax

import Podtable from  "podtable"
@import "~podtable/dist/podtable.css"

Quick Note :

  • Podtable will use the last cell of every row including the head as control column.

  • Or you can define an empty cell for podtable to use as control column.

  • Its really important to include the podtable stylesheet because podtable relies on it.

  • Also podtable css doesn't include general table styling only css which it needs so you can style your table as you want.

  • Also never include more that one row in the able header currently this will prevent podtable from working properly

  • if you are using vuejs always provide a Unique key for your v-for because of vue's In-place-patch strategy.

Your HTML structure

<table id="table" class="table" width="100%">
    <thead>
        <tr>
            <th>Firstname</th>
            <th>Lastname</th>
            ...
            <th></th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Mark</td>
            <td>Spencer</td>
            ...
            <td></td>
        </tr>
    </tbody>
</table>

Then initialize podtable by passing the table selector

new Podtable('#table', {
    // config options
})

Or passing the element directly

new Podtable(document.querySelector('#table'), {
    // config options
})

The podtable instance receives two params the first parameter is an element selector or a table element and also the second parameter is a config object which receives a key value pairs in achieving a responsive table which can be use together or as your use case demands.

Config Options

  • KeepCell
  • priority
  • method
  • rowGroup

keepCell

which is an array of cells index that wont be hidden. Also note the first cell for the table rows with an index of 0 will not be hidden by default.

new Podtable('#table', {
    keepCell: [1, 6],
});

priority

This config option which is an array of index of cells, which determines how cells will be hidden and if only few cell index are passed to the priority config object this will take precedence over the other cell index.

new Podtable('#table', {
    priority: [2, 4, 5]
})

method

This config option option which takes in a function to be executed for the hidden cells. and the function receives a parameter to acess the index of the cell that was last hidden.

new Podtable('#table', {
    method: (state) => {
        if(state.current == 5) {
            // do something
        }
    }
});

rowGroup

This config option which takes in a boolean in order to use the row group feature, so for this to work

  • Data Iteration needs to be done via the body tag that is rows should be grouped together via the body tag

  • podtable assumes every first row of each body tag is the row group header hence there is need to let podtable know it should ignore it using a dataset data-ptr-ignore This attribute make podtable ignore the row entire from control and responsive action hence a colspan is important to avoid breaking the table behaviour

  • Content in your ignored rows should be wrapable and should not have a fixed width

  • Your ignored row td cells should have colspan that will correspond to the number of cells in other rows.

  • Currently the dataset data-ptr-ignore is only meant for the body tag when you are using row group feature and also in the footer while you use it in the footer make sure you add apply your colspan.

new Podtable('#table', {
    rowGroup: true
});
<table id="table" class="table" width="100%">
    <thead>
        <tr>
            <th>Firstname</th>
            <th>Lastname</th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        <tr data-ptr-ignore="">
            <td colspan="3"></td>
        </tr>
        <tr>
            <td>Mark</td>
            <td>Spencer</td>
            <td></td>
        </tr>
    </tbody>
    ...
    <!-- more body tags here grouping rows together -->
</table>

In fact for every row group you can define an extra row in order to show empty row group message.

<table id="table" class="table" width="100%">
    <thead>
        <tr>
            <th>Firstname</th>
            <th>Lastname</th>
            ...
            <th></th>
        </tr>
    </thead>
    <tbody>
        <tr data-ptr-ignore="">
            <td colspan="3">This is the Heading</td>
        </tr>

        <!-- other rows if there is data to show -->

        <tr data-ptr-ignore="">
            <td colspan="3">
                Sorry no record to show
            </td>
        </tr>
    </tbody>
</table>

Instance methods

  • destroy()

destroy()

The destroy method revert any alteration to the table in the DOM and detach all event listeners.

const podtable = new Podtable('#table', { 
    // config 
});

podtable.destroy()

Contributing

Thank you for considering to contribute to Podtablejs, pull requests, is highly recommended not just bug reports & dont forget to star this repo.

Examples

you can view it live on codepen

Roadmap

  • More awesomeness in achieving a responsive datatable. 😊

License

Podtablejs is an open-sourced software licensed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].