Advertisement
tatdat171

Controller Datatable

Jul 23rd, 2015
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. 'use strict';
  3.  
  4. app.controller('FirewallCtrl', ['$scope', '$http', '$modal', '$resource', 'DTOptionsBuilder', 'DTColumnDefBuilder', 'toastr', 'ManagerVersionService',
  5.     function ($scope, $http, $modal, $resource, DTOptionsBuilder, DTColumnDefBuilder, toastr, ManagerVersionService) {
  6.  
  7.         $scope.Test = 'Data is testing'
  8.  
  9.         var vm = this;
  10.  
  11.         var LinkGetListFirewall = 'http://localhost:53073/Apps/Firewall/data.txt';
  12.  
  13.  
  14.         $scope.ReloadData = function (filter) {
  15.             /// <summary>
  16.             /// Function reload Data
  17.             /// </summary>
  18.             vm.Items = $resource(LinkGetListFirewall, {}, { 'query': { method: 'GET', isArray: false } }).query(function (msg) {
  19.                 var Data = {};
  20.                 Data.data = msg;
  21.  
  22.  
  23.             }, function (error) {
  24.                 // error handler
  25.                 toastr.error('Hệ thống bị lỗi, liên hệ với quản trị hệ thống!', 'Hệ thống')
  26.             });
  27.         };
  28.         //Get Data first time
  29.         $scope.ReloadData();
  30.  
  31.         vm.dtOptions = DTOptionsBuilder.newOptions()
  32.             .withPaginationType('full_numbers')
  33.             .withDisplayLength(5)
  34.             .withDOM('rtp<"m-t-xs pull-left"f>')
  35.             // Active Responsive plugin
  36.             .withOption('responsive', true)
  37.             .withBootstrap()
  38.             .withBootstrapOptions({
  39.                 TableTools: {
  40.                     classes: {
  41.                         container: 'btn-group',
  42.                         buttons: {
  43.                             normal: 'btn-pxl btn-icon'
  44.                         }
  45.                     }
  46.                 },
  47.                 pagination: {
  48.                     classes: {
  49.                         ul: 'pagination pagination-sm'
  50.                     }
  51.                 }
  52.             })
  53.  
  54.             .withTableTools('Libs/datatables/TableTools/swf/copy_csv_xls_pdf.swf')
  55.             .withColumnFilter();
  56.  
  57.         vm.dtColumnDefs = [
  58.             DTColumnDefBuilder.newColumnDef(0),
  59.             DTColumnDefBuilder.newColumnDef(1),
  60.             DTColumnDefBuilder.newColumnDef(2),
  61.             DTColumnDefBuilder.newColumnDef(3),
  62.             DTColumnDefBuilder.newColumnDef(4),
  63.             DTColumnDefBuilder.newColumnDef(5),
  64.             DTColumnDefBuilder.newColumnDef(6),
  65.             DTColumnDefBuilder.newColumnDef(7),
  66.             DTColumnDefBuilder.newColumnDef(8).withClass('none'),
  67.             DTColumnDefBuilder.newColumnDef(9).notSortable()
  68.         ];
  69.  
  70.  
  71.  
  72.         $scope.SetDataTransfer = function (Data) {
  73.             ManagerVersionService.DataTransfer = Data;
  74.         }
  75.  
  76.     }])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement