Git Product home page Git Product logo

tablepricing's Introduction

tablepricing

An extended AngularJS Directive pricing-table with form, pagination, and other added features. (supports twitter bootstrap v3).

tablepricing

Install

bower install tablepricing --save

or Include all neccessary files

<link rel="stylesheet" href="bower_components/bootstrap/dist/bootstrap.min.css" />
<link rel="stylesheet" href="bower_components/tablepricing/build/pricing-table.css" />

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

Documentation

Configuration

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

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

Populating a tablePricing using HTML

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

The attributes are described as follows:

  • columns - The pricing-table Setings for columns (is JSONObject)(is Required).
    • titleIndex - The pricing-table Index column for display titles (is String).
    • columns - The pricing-table needs to display the columns (is Array)(is Required).
  • store - The pricing-table needs to data store (is Array)(is Required).
  • pagination - Paging configuration (is JSONObject)(Optional):
    • total - Total data.(is Number).
    • currentPage - The current page.(is Number).
    • pageCount - The total number of pages. (is Number).
    • goToFirst - First page button click event. (is Function).
    • goToPrevious - Previous page button click event. (is Function).
    • goToNext - Next page button click event. (is Function).
    • goToLast - Last page button click event. (is Function).
  • operation - The pricing-table footer operation button configuration (is JSONObject)(Optional):
    • text - Button text. (is String).
    • cls - Button class. (is String).
    • iconCls - Icon class. (is String).
    • handlers - Button handler. (is JSONObject).
      • click - Button click event. (is Function).

Add the following code in your controller :

$scope.columns = {
  titleIndex: 'title',
  columns: [{
    text: 'User Code',
    dataIndex: 'uuid'
  },{
    text: 'User Name',
    iconCls: 'icon-user',
    dataIndex: 'name'
  },{
    text: 'Phone',
    dataIndex: 'phone'
  },{
    text: 'Create Date',
    filter: {
      type: 'date',
      format: 'yyyy-MM-dd'
    },
    dataIndex: 'createDate'
  }]
};
function requestTableDataFunction(){
  $http.get('json/table-pricing.json')
    .success(function(response){
      $scope.store = response;
    })
    .error(function(er){
      console.log(er);
    });
}

var startpage = 1;
$scope.pagination = {
  total: 0,
  currentPage: 0,
  pageCount: 0,
  goToFirst : function(){
    startpage = 1;
    requestTableDataFunction();
  },
  goToPrevious : function(){
    startpage--;
    requestTableDataFunction();
  },
  goToNext : function(){
    startpage++;
    requestTableDataFunction();
  },
  goToLast : function(){
    startpage = $scope.pagination.pageCount;
    requestTableDataFunction();
  }
};

$scope.operation = {
  text: 'Go',
  cls: 'btn btn-info',
  iconCls: 'm-icon-swapright m-icon-white',
  handlers: {
    click: function(item){
      console.log(item);
    }
  }
};

tablepricing'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.