All Projects → awerlang → Angular Responsive Tables

awerlang / Angular Responsive Tables

Licence: mit
Make your HTML tables look great on every device

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Angular Responsive Tables

Embla Carousel
A lightweight carousel library with fluid motion and great swipe precision.
Stars: ✭ 1,874 (+2615.94%)
Mutual labels:  mobile, mobile-web
Jscost.org
JSCost.org - a JavaScript cost visualizer 💸
Stars: ✭ 101 (+46.38%)
Mutual labels:  mobile, mobile-web
Mobiscroll
Cross platform UI controls for progressive web and hybrid apps (plain JS, jQuery, Angular and React)
Stars: ✭ 1,510 (+2088.41%)
Mutual labels:  angularjs, mobile-web
Nghandsontable
Official AngularJS directive for Handsontable
Stars: ✭ 438 (+534.78%)
Mutual labels:  table, angularjs
Keen Slider
The HTML touch slider carousel with the most native feeling
Stars: ✭ 3,097 (+4388.41%)
Mutual labels:  mobile, mobile-web
Components
MobileUI was created thinking of making your hybrid application faster and smaller since you only install what you are really going to use for UI.
Stars: ✭ 125 (+81.16%)
Mutual labels:  mobile, mobile-web
Countly Sdk Cordova
Countly Product Analytics SDK for Cordova, Icenium and Phonegap
Stars: ✭ 69 (+0%)
Mutual labels:  mobile, mobile-web
React Native Data Table
Stars: ✭ 133 (+92.75%)
Mutual labels:  mobile, table
Pdfh5
web/h5/移动端PDF预览插件
Stars: ✭ 423 (+513.04%)
Mutual labels:  mobile, mobile-web
H5ui
Lightweight, elegant open source mobile UI style library.
Stars: ✭ 44 (-36.23%)
Mutual labels:  mobile, mobile-web
Truetime Android
Android NTP time library. Get the true current time impervious to device clock time changes
Stars: ✭ 1,134 (+1543.48%)
Mutual labels:  mobile
Gmimagepicker.xamarin
Port of the original GMImagePicker component to Xamarin.iOS
Stars: ✭ 65 (-5.8%)
Mutual labels:  mobile
Alpaca Rn Mobile
An example React native mobile app to help you get started with Alpaca
Stars: ✭ 67 (-2.9%)
Mutual labels:  mobile
Cyber Camera
Turns any webcam into a smart security camera for home surveillance
Stars: ✭ 68 (-1.45%)
Mutual labels:  mobile
Web Components Angular React
Multiple apps as components POC
Stars: ✭ 64 (-7.25%)
Mutual labels:  angularjs
Cone
A ledger.
Stars: ✭ 66 (-4.35%)
Mutual labels:  mobile
Sycophant
Numerous Ninjas: Beta stage mobile game written in Unity
Stars: ✭ 64 (-7.25%)
Mutual labels:  mobile
One Punch Fitness
A "One Punch Man"-inspired workout app!
Stars: ✭ 64 (-7.25%)
Mutual labels:  mobile
React Ant Pro
(基于pro 1.0)基于Ant Design Pro 后台项目修改的多标签页tabs(多标签tabs、拖拽、富文本、多功能table、多选Select、React Hooks)
Stars: ✭ 64 (-7.25%)
Mutual labels:  table
Mean Stack Angular6 Crud Example
MEAN Stack Angular 6 CRUD Web Application
Stars: ✭ 69 (+0%)
Mutual labels:  angularjs

angular-responsive-tables

Make your HTML tables look great on every device. Compatible with AngularJS 1.3.4+.

Live Demo

Why?

Currently, browsers for mobile devices like smartphones doesn't do anything to have a proper presentation of tables, and then scrollbars will show up and ruin your design.

In the search of a solution to this problem I have found many different approaches. Some of them still rely on horizontal scrollbars. While I believe this layout could be useful for some use cases, I felt that a default solution should avoid horizontal scrollbars entirely. Then I came up with this highly reusable directive.

All this work is based on the following assumptions:

  • If it is flexible, then it would solve most problems, even ones not aimed by the library author's;
  • Focusing on the task of adding responsiveness, in order to accomplish a greater objective (easy to use tabular data);
  • Do work with a standard HTML table, not requiring any extraneous markup;
  • Do not change default tabular layout unless a smaller display is detected;
  • Provide convenience without sacrificing flexibility;
  • By keeping code base simple, it is easier to reason about and evolve;
  • By fully covering with tests, it can evolve without introducing bugs.

Features

  • Angular native implementation compatible with 1.3.4+;
  • Keep things DRY;
  • Supports static and dynamic (ng-repeat) rows;
  • Supports conditionally shown (ng-if) columns;
  • Supports dynamic headers (ng-repeat);
  • Supports nested tables (responsive or not in their own right);
  • Easy to apply any style on top of it;
  • Works with any base CSS framework;
  • Should integrate seamlessly with any table component you might choose to use.

Future Work

  • Choose what columns to show/hide according to a given screen resolution;
  • Choose when it would be best to hide columns or collapse all columns;
  • Define a header and/or custom template for collapsed columns/row;
  • Allow collapse/expand column details.

Usage

<table wt-responsive-table>
    <tr>
        <th>Column 1</th>
        <th>Column 2</th>
        <th>Column 3</th>
        <th>Column 4</th>
    </tr>
    <tr>
        <td>...</td>
        <td>...</td>
        <td>...</td>
        <td>...</td>
    </tr>
    <tr>
        <td>...</td>
        <td>...</td>
        <td>...</td>
        <td>...</td>
    </tr>
    <tr>
        <td>...</td>
        <td>...</td>
        <td>...</td>
        <td>...</td>
    </tr>
</table>

Directives

wt-responsive-table

  • table: wt-responsive-table
    • td: responsive-omit-title: title should be ommited
    • td: responsive-omit-if-empty: no row for empty cells
    • td: data-title: use to override the header for a given row/cell

Installation

npm

npm install --save angular-responsive-tables

Bower

bower install angular-responsive-tables --save

Application

HTML

<link rel="stylesheet" href="release/angular-responsive-tables.min.css">
<script type="text/javascript" src="release/angular-responsive-tables.min.js"></script>

JavaScript

var app = angular.module('app', ['wt.responsive']);

Special cases

Header doesn't appear for a row / need to override header

It's possible to override a header with a data-title attribute:

<tr>
    <td data-title="column 1">tom</td>
    <td data-title="column 2">jerry</td>
</tr>

Changes to header text doesn't reflect in responsive mode

This is by design. To avoid expensive digest cycles only the content from the first digest cycle is used. There are no watchers being setup.

Dynamic column names

When loading column names with an asynchronous task, that is, column names are not available when first compiling the table element, rows in responsive mode won't have headers even after the task completes.

To avoid this problem, use an ng-if to conditionally present the element on screen.

<table wt-responsive-table ng-if="columnNames && columnNames.length">

IE9 responsive hack

Because IE9 doesn't handle correctly a display CSS rule for <td>, if you need to support it, you can use the following style, only for IE9:

<!--[if IE 9]>
<style>
/* rules for IE9 only */
.responsive {
    overflow: hidden;
}
.responsive td:nth-child(odd), .responsive td:nth-child(even) {
    float: left;
    width: 100%;
}
</style>
<![endif]-->

Credits

CSS based on original work by Chris Coyier (http://css-tricks.com/responsive-data-tables/). In this article, he covers approaches to responsive tables. I modified it to work around CSS specificity and to keep things DRY.

License

MIT

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].