Code Monkey home page Code Monkey logo

bs-table's Introduction

bs-table

BsTable is an AngularJS directive which allows pagination, sorting and page size selection with data on client side.

Easy to implement with any theme from http://bootswatch.com/ site.

working sample

You can find working sample here: http://www.bs-table.com

how to use

  1. Include necessary source files
// you can easily implement any bootstrap theme from http://bootswatch.com
<link type="text/css" href="/bootstrap/bootstrap.min.css" rel="stylesheet" />
// include latest jquery.min.js
<script type="text/javascript" src="/js/jquery.min.js"></script>
// include bs-table.min.js
<script type="text/javascript" src="/js/bs-table.min.js"></script>
  1. Import module to your application
angular.module("BsTableApplication", ["bsTable"]);
  1. Add this html code to your template
<table class="table table-hover table-bordered" bs-table>
    <tr ng-repeat="contact in contactList">
        <td data-title="First name">{{contact.FirstName}}</td>
        <td data-title="Last name">{{contact.LastName | removeDiacritics}}</td>
        <td data-type="command" class="action-column">
            <button type="button" class="btn btn-info btn-sm" ng-click="Edit(contact)">Edit</button>
        </td>
    </tr>
</table>

For columns that contains text use attribute data-title="Text of title" and for columns with buttons use data-type="command".

  1. Add this js code to your controller
// model for bs-table
$scope.contactList = [];

// get contact list
$scope.contactList = GenerateData(40);
  1. Additional css code (not necessary)
.action-column{ // width of three action buttons
    width: 230px;
}
.table th:hover{
    text-decoration: underline;
    cursor: pointer;
}
.table tfoot .pagination{
    float: right;
    margin: 0;
}
.table tfoot .pagination li{
    cursor: pointer;
}
.table tfoot select{
    width: 90px;
    float: right;
    margin-right: 8px;
}

license

BsTable is licensed under the MIT license. (http://opensource.org/licenses/MIT)

bs-table's People

Contributors

janholinka avatar

Watchers

James Cloos avatar sandy avatar

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.