Skip to content

Commit 60e5e38

Browse files
committed
Merge pull request wenzhixin#46 from dbkaplun/angular
Fix angularjs example
2 parents ea5a977 + 8e82493 commit 60e5e38

File tree

2 files changed

+58
-57
lines changed

2 files changed

+58
-57
lines changed

integrate/angularjs.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
1212
<!-- Latest compiled and minified CSS -->
1313
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.8.1/bootstrap-table.min.css">
14-
14+
1515
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
1616
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
1717
<!-- Latest compiled and minified JavaScript -->
@@ -31,8 +31,7 @@
3131

3232
<!-- Workspaces containers -->
3333
<div class="workspaceContainer" ng-repeat="wk in workspaces" ng-show="currentWorkspace==wk">
34-
35-
<table data-options="wk.tableOptions" bs-table-control> </table>
34+
<table bs-table-control="wk.bsTableControl"></table>
3635
</div>
3736

3837

integrate/app.js

Lines changed: 56 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -26,64 +26,66 @@ angular.module('app', ['bsTable'])
2626
var colData = {workspace: wk.name};
2727
wk.rows = makeRandomRows(colData);
2828
setInterval(function () {
29-
wk.rows = wk.tableOptions.data = makeRandomRows(colData);
29+
wk.rows = wk.bsTableControl.options.data = makeRandomRows(colData);
3030
$scope.$applyAsync();
3131
}, 5000);
3232

33-
wk.tableOptions = {
34-
data: wk.rows,
35-
rowStyle: function (row, index) {
36-
return { classes: 'none' };
37-
},
38-
cache: false,
39-
height: 400,
40-
striped: true,
41-
pagination: true,
42-
pageSize: 10,
43-
pageList: [5, 10, 25, 50, 100, 200],
44-
search: true,
45-
showColumns: true,
46-
showRefresh: false,
47-
minimumCountColumns: 2,
48-
clickToSelect: false,
49-
showToggle: true,
50-
maintainSelected: true,
51-
columns: [{
52-
field: 'state',
53-
checkbox: true
54-
}, {
55-
field: 'index',
56-
title: '#',
57-
align: 'right',
58-
valign: 'bottom',
59-
sortable: true
60-
}, {
61-
field: 'id',
62-
title: 'Item ID',
63-
align: 'center',
64-
valign: 'bottom',
65-
sortable: true
66-
}, {
67-
field: 'name',
68-
title: 'Item Name',
69-
align: 'center',
70-
valign: 'middle',
71-
sortable: true
72-
}, {
73-
field: 'workspace',
74-
title: 'Workspace',
75-
align: 'left',
76-
valign: 'top',
77-
sortable: true
78-
}, {
79-
field: 'flag',
80-
title: 'Flag',
81-
align: 'center',
82-
valign: 'middle',
33+
wk.bsTableControl = {
34+
options: {
35+
data: wk.rows,
36+
rowStyle: function (row, index) {
37+
return { classes: 'none' };
38+
},
39+
cache: false,
40+
height: 400,
41+
striped: true,
42+
pagination: true,
43+
pageSize: 10,
44+
pageList: [5, 10, 25, 50, 100, 200],
45+
search: true,
46+
showColumns: true,
47+
showRefresh: false,
48+
minimumCountColumns: 2,
8349
clickToSelect: false,
84-
formatter: flagFormatter,
85-
// events: flagEvents
86-
}]
50+
showToggle: true,
51+
maintainSelected: true,
52+
columns: [{
53+
field: 'state',
54+
checkbox: true
55+
}, {
56+
field: 'index',
57+
title: '#',
58+
align: 'right',
59+
valign: 'bottom',
60+
sortable: true
61+
}, {
62+
field: 'id',
63+
title: 'Item ID',
64+
align: 'center',
65+
valign: 'bottom',
66+
sortable: true
67+
}, {
68+
field: 'name',
69+
title: 'Item Name',
70+
align: 'center',
71+
valign: 'middle',
72+
sortable: true
73+
}, {
74+
field: 'workspace',
75+
title: 'Workspace',
76+
align: 'left',
77+
valign: 'top',
78+
sortable: true
79+
}, {
80+
field: 'flag',
81+
title: 'Flag',
82+
align: 'center',
83+
valign: 'middle',
84+
clickToSelect: false,
85+
formatter: flagFormatter,
86+
// events: flagEvents
87+
}]
88+
}
8789
};
8890
function flagFormatter(value, row, index) {
8991
return '<img src="' + row.flagImage + '"/>'

0 commit comments

Comments
 (0)