Giter VIP home page Giter VIP logo

angular-dragtable's Introduction

Angular Dragtable

Directive that allows reorder of table columns.

Dependencies

This directive needs jQuery to work.

Installation

Download files or use bower: bower install angular-dragtable.

Usage

First include Angular Dragtable in your project:

(function (DemoApp) {
  'use strict';

  DemoApp = angular.module('DemoApp', ['Dragtable']);

  DemoApp.config(function () {});
}(this));

To allow column reorder, add directives drag-me and drop-me on th elements, like this:

<table>
  <thead>
    <tr>
      <th>ID</th>
      <th drag-me drop-me>Name</th>
      <th drag-me drop-me>Description</th>
      <th drag-me drop-me>Age</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>1</td>
      <td>Item 1</td>
      <td>Description 1</td>
      <td>1</td>
    </tr>
    ...
  </tbody>
</table>

Options

handle

To prevent drag event on whole th element, provide data-handle attribute with handle selector, like this:

<th drag-me drop-me data-handle=".handle">Name <span class="handle">Handle</span></th>

Now column could be dragged only using provided handle element. Note that handle element should be inside of th element.

limit

To prevent performance issues, you could limit the number of ghost elements by providing data-limit attribute. Add number of rows that should be duplicated, like this:

<th drag-me drop-me data-limit="50">Name</th>

Guide

https://silvestar.codes/articles/angular-dragtable

angular-dragtable's People

Contributors

malimirkec avatar mauryashashi avatar sbistrovic avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

angular-dragtable's Issues

Columns data disappear.

Hi,
Thanks for this good directive. It works well on some tables but in others after draging a column it data disappear like in the pictrue below.
1
2

EDIT:
I figured out that this happens when using two tables in the same page. Is there a way to fix this ?

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.