Git Product home page Git Product logo

tablepagination's Introduction

tablepagination

An extended AngularJS Directive table with radio, checkbox, sort, pagination, and other added features. (supports twitter bootstrap v3).

Install

bower install tablepagination --save

or Include all neccessary files

<link rel="stylesheet" href="bower_components/bootstrap/dist/bootstrap.min.css" />

<script src="bower_components/angular/angular.min.js"></script>
<script src="bower_components/tablepagination/build/tablepagination.min.js"></script>

Documentation

Configuration

An extended AngularJS Directive table. Configure the directive to your AngularJSApp [app.js].

angular.module('your app name', [
    ......,
    'tablePagination'
  ]);

Populating a tablePagination using HTML

<table-pagination columns="columns" store="store" events="events" operation="operation"></table-pagination>

The attributes are described as follows:

  • columns - The table needs to display the columns (is Array)(is Required).
  • store - The table needs to data store (is Array)(is Required).
  • events - This table triggered event(is JSONObject)(Optional). as: checked (Return function when the form is selected).
  • operation - The table last column operation button configuration (is JSONObject)(Optional):
    • text - Button text. (is String)
    • click - Button click event. (is Function)

Add the following code in your controller :

/**
 * @description Definition columns
 * @param {String}text Header text
 * @param {Function}getData(data) Receive column data, return the required column values
 * @param {boolean}display show/hide
 */
$scope.columns = [{
  text: 'User Name',
  getData: function(data){
    return data.name;
  },
  display: true
},{
  text: 'Code',
  getData: function(data){
    return data.uuid;
  },
  display: true
}];
//Data Store
$scope.store = [{
  uuid: '1001', name: '1001'
},{
  uuid: '1002', name: '1002'
}];
$scope.events = {
  //Return function when the form is selected,Param (item) as Data model is selected
  checked: function(item){
    console.log(item);
  },
  load: function(pagination){
    $scope.pagination = pagination;
    $http.get('json/table-pagination.json').success(function(response){
      $scope.store = response;
    })
  }
};

//The table last column operation button configuration
$scope.operation = {
  text: 'detail',
  click: function(item){
    requestItemInfoById(item.uuid);
  }
};

tablepagination's People

Contributors

tangfang avatar

Watchers

James Cloos avatar Guido Calcina Tipo 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.