Skip to content

Commit 92a0370

Browse files
Portugal, Marcelomportuga
Portugal, Marcelo
authored andcommitted
docs(multiFiles): Document examples of the multi-file support
1 parent 1342f80 commit 92a0370

File tree

63 files changed

+456
-76
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+456
-76
lines changed

misc/tutorial/101_intro.ngdoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Steps:
2727
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.6.7/angular.min.js"></script>
2828
<script src="/release/ui-grid.min.js"></script>
2929
<!-- Or the following if you don't want to use all features -->
30-
<!-- <script src="/release/ui-grid.base.min.js"></script> -->
30+
<!-- <script src="/release/ui-grid.core.min.js"></script> -->
3131
</pre>
3232
</li>
3333
<li>Include ui.grid module as a dependency in your app

misc/tutorial/102_sorting.ngdoc

+5
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ The sorting algorithm function takes 'a' and 'b' parameters like any normal sort
4242
By default the sorting algorithm will be applied to the row value before any `cellFilters` are applied. The {@link api/ui.grid.class:GridOptions.columnDef#sortCellFiltered sortCellFiltered}
4343
columnDef option will cause sorting to be applied after the `cellFilters` are applied. For an example of this see the "Month Joined" column in the {@link 401_AllFeatures AllFeatures tutorial}.
4444

45+
For better performance with the following example, you can choose to load the ui-grid.core.js file instead:
46+
<pre>
47+
<script src="/release/ui-grid.core.min.js"></script>
48+
</pre>
49+
4550
<example module="app">
4651
<file name="app.js">
4752
angular.module('app', ['ngAnimate', 'ngTouch', 'ui.grid'])

misc/tutorial/103_filtering.ngdoc

+5
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ columnDef option will cause filtering to be applied after the `cellFilters` are
8383

8484
Refer {@link 321_singleFilter singleFilter tutorial}, it is possible to implement this using a rowsProcessor.
8585

86+
For better performance with the following example, you can choose to load the ui-grid.core.js file instead:
87+
<pre>
88+
<script src="/release/ui-grid.core.min.js"></script>
89+
</pre>
90+
8691
@example
8792
<example module="app">
8893
<file name="app.js">

misc/tutorial/105_footer.ngdoc

+5
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ In the case of grouping the solution is to use the aggregation provided with gro
2727
<br/>
2828
You can override the default grid footer template with gridOptions.footerTemplate. Copy the default ui-grid-footer.html from the source as your starting point. <i>This is not demonstrated in this tutorial.</i>
2929

30+
For better performance with the following example, you can choose to load the ui-grid.core.js file instead:
31+
<pre>
32+
<script src="/release/ui-grid.core.min.js"></script>
33+
</pre>
34+
3035
@example
3136
<example module="app">
3237
<file name="app.js">

misc/tutorial/106_binding.ngdoc

+27-22
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,42 @@ COL\_FIELD which will be replaced with grid.getCellValue(row). This should be us
1414
<br/>
1515
MODEL\_COL\_FIELD which will be replaced with row.entity.field. Use MODEL\_COL\_FIELD anytime you need ng-model='field'
1616

17-
17+
For better performance with the following example, you can choose to load the ui-grid.core.js and specific feature files instead:
18+
<pre>
19+
<script src="/release/ui-grid.core.min.js"></script>
20+
<script src="/release/ui-grid.edit.min.js"></script>
21+
</pre>
1822

1923
@example
2024
<example module="app">
2125
<file name="app.js">
2226
var app = angular.module('app', ['ngTouch', 'ui.grid', 'ui.grid.edit']);
2327

24-
app.controller('MainCtrl', ['$scope', function ($scope) {
25-
26-
$scope.gridOptions = {
27-
enableSorting: true,
28-
columnDefs: [
29-
{ name:'firstName', field: 'first-name' },
30-
{ name:'1stFriend', field: 'friends[0]' },
31-
{ name:'city', field: 'address.city'},
32-
{ name:'getZip', field: 'getZip()', enableCellEdit:false}
33-
],
34-
data : [ {
35-
"first-name": "Cox",
36-
"friends": ["friend0"],
37-
"address": {street:"301 Dove Ave", city:"Laurel", zip:"39565"},
38-
"getZip" : function() {return this.address.zip;}
39-
}
40-
]
41-
};
28+
app.controller('MainCtrl', function MainCtrl() {
29+
var vm = this;
4230

43-
}]);
31+
vm.gridOptions = {
32+
enableSorting: true,
33+
columnDefs: [
34+
{ name:'firstName', field: 'first-name' },
35+
{ name:'1stFriend', field: 'friends[0]' },
36+
{ name:'city', field: 'address.city'},
37+
{ name:'getZip', field: 'getZip()', enableCellEdit: false}
38+
],
39+
data: [
40+
{
41+
'first-name': 'Cox',
42+
friends: ['friend0'],
43+
address: {street: '301 Dove Ave', city: 'Laurel', zip: '39565'},
44+
getZip: function() {return this.address.zip;}
45+
}
46+
]
47+
};
48+
});
4449
</file>
4550
<file name="index.html">
46-
<div ng-controller="MainCtrl">
47-
<div id="grid1" ui-grid="gridOptions" ui-grid-edit class="grid"></div>
51+
<div ng-controller="MainCtrl as $ctrl">
52+
<div id="grid1" ui-grid="$ctrl.gridOptions" ui-grid-edit class="grid"></div>
4853
</div>
4954
</file>
5055
<file name="main.css">

misc/tutorial/108_hidden_grids.ngdoc

+16-10
Original file line numberDiff line numberDiff line change
@@ -39,31 +39,37 @@ In order to fix this you <strong>must</strong> give the grid something to work w
3939

4040
It's all up to you. And if you know a better way then please submit it in an issue or a pull request. There's always room for improvement and innovation.
4141

42+
For better performance with the following example, you can choose to load the ui-grid.core.js file instead:
43+
<pre>
44+
<script src="/release/ui-grid.core.min.js"></script>
45+
</pre>
4246

4347
@example
4448
<example module="app">
4549
<file name="app.js">
4650
var app = angular.module('app', ['ngTouch', 'ui.grid']);
4751

48-
app.controller('MainCtrl', ['$scope', '$http', function ($scope, $http) {
49-
$scope.hideGrid = true;
52+
app.controller('MainCtrl', function ($http) {
53+
var vm = this;
5054

51-
$scope.gridOptions = { };
55+
vm.hideGrid = true;
56+
57+
vm.gridOptions = { };
5258

5359
$http.get('/data/100.json')
5460
.then(function(response) {
55-
$scope.gridOptions.data = response.data;
61+
vm.gridOptions.data = response.data;
5662
});
57-
}]);
63+
});
5864
</file>
5965
<file name="index.html">
60-
<div ng-controller="MainCtrl">
61-
<button type="button" class="btn btn-success" ng-click="hideGrid = !hideGrid">
62-
{{ hideGrid && 'Show' || 'Hide' }} Grid
66+
<div ng-controller="MainCtrl as $ctrl">
67+
<button type="button" class="btn btn-success" ng-click="$ctrl.hideGrid = !$ctrl.hideGrid">
68+
{{ $ctrl.hideGrid && 'Show' || 'Hide' }} Grid
6369
</button>
6470

65-
<div class="well" ng-hide="hideGrid">
66-
<div ui-grid="gridOptions" class="grid"></div>
71+
<div class="well" ng-hide="$ctrl.hideGrid">
72+
<div ui-grid="$ctrl.gridOptions" class="grid"></div>
6773
</div>
6874
</div>
6975
</file>

misc/tutorial/109_multiple_grids.ngdoc

+16-9
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,42 @@
44

55
Using multiple grids on a single page
66

7+
For better performance with the following example, you can choose to load the ui-grid.core.js file instead:
8+
<pre>
9+
<script src="/release/ui-grid.core.min.js"></script>
10+
</pre>
11+
712
@example
813
<example module="app">
914
<file name="app.js">
1015
var app = angular.module('app', ['ngTouch', 'ui.grid']);
1116

12-
app.controller('MainCtrl', ['$scope', '$http', function ($scope, $http) {
13-
$scope.gridOptions1 = {};
14-
$scope.gridOptions2 = {};
17+
app.controller('MainCtrl', function ($http) {
18+
var vm = this;
19+
20+
vm.gridOptions1 = {};
21+
vm.gridOptions2 = {};
1522

1623
$http.get('/data/100.json')
1724
.then(function(response) {
18-
$scope.gridOptions1.data = response.data;
25+
vm.gridOptions1.data = response.data;
1926
});
2027

2128
$http.get('/data/500.json')
2229
.then(function(response) {
23-
$scope.gridOptions2.data = response.data;
30+
vm.gridOptions2.data = response.data;
2431
});
25-
}]);
32+
});
2633
</file>
2734
<file name="index.html">
28-
<div ng-controller="MainCtrl">
35+
<div ng-controller="MainCtrl as $ctrl">
2936
<div class="row">
3037
<div class="span4">
31-
<div id="grid1" ui-grid="gridOptions1" class="grid"></div>
38+
<div id="grid1" ui-grid="$ctrl.gridOptions1" class="grid"></div>
3239
</div>
3340

3441
<div class="span4">
35-
<div id="grid2" ui-grid="gridOptions2" class="grid"></div>
42+
<div id="grid2" ui-grid="$ctrl.gridOptions2" class="grid"></div>
3643
</div>
3744
</div>
3845
</div>

misc/tutorial/110_grid_in_modal.ngdoc

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ so the currently recommended approach is to use $interval, and to call every 500
1212

1313
In a sense this is similar to what the auto-resize feature does, but it only does it for a short period after modal opening.
1414

15+
$ctrlFor better performance with the following example, you can choose to load the ui-grid.core.js file instead:
16+
<pre>
17+
<script src="/release/ui-grid.core.min.js"></script>
18+
</pre>
19+
1520
<example module="app">
1621
<file name="app.js">
1722
var app = angular.module('app', ['ngTouch', 'ui.grid']);

misc/tutorial/111_cellClass.ngdoc

+12-6
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@ A class name or function returning a class name can be assigned to each columnDe
66

77
In this example, we will override the color and background for the first column and color the company text blue if it equals 'Velity'.
88

9+
For better performance with the following example, you can choose to load the ui-grid.core.js file instead:
10+
<pre>
11+
<script src="/release/ui-grid.core.min.js"></script>
12+
</pre>
913

1014
<example module="app">
1115
<file name="app.js">
1216
var app = angular.module('app', ['ngAnimate', 'ngTouch', 'ui.grid']);
1317

14-
app.controller('MainCtrl', ['$scope', '$http', function ($scope, $http) {
15-
$scope.gridOptions = {
18+
app.controller('MainCtrl', function MainCtrl($http) {
19+
var vm = this;
20+
21+
vm.gridOptions = {
1622
enableSorting: true,
1723
columnDefs: [
1824
{ field: 'name', cellClass:'red' },
@@ -28,14 +34,14 @@ In this example, we will override the color and background for the first column
2834

2935
$http.get('/data/100.json')
3036
.then(function(response) {
31-
$scope.gridOptions.data = response.data;
37+
vm.gridOptions.data = response.data;
3238
});
33-
}]);
39+
});
3440
</file>
3541
<file name="index.html">
36-
<div ng-controller="MainCtrl">
42+
<div ng-controller="MainCtrl as $ctrl">
3743
<br>
38-
<div id="grid1" ui-grid="gridOptions" ng-if="gridOptions.data" class="grid"></div>
44+
<div id="grid1" ui-grid="$ctrl.gridOptions" ng-if="$ctrl.gridOptions.data" class="grid"></div>
3945
</div>
4046
</file>
4147
<file name="main.css">

misc/tutorial/112_swapping_data.ngdoc

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
You can swap out data in the grid by simply providing a different reference.
66

7+
For better performance with the following example, you can choose to load the ui-grid.core.js file instead:
8+
<pre>
9+
<script src="/release/ui-grid.core.min.js"></script>
10+
</pre>
11+
712
@example
813
<example module="app">
914
<file name="app.js">

misc/tutorial/113_adding_and_removing_columns.ngdoc

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ although if/when the column move feature arrives the end user will be able to al
88
that default.
99

1010
You can dynamically change the display name on a column (along with some other column
11-
def properties), and call the notifyDataChange api to force an update.
11+
def properties), and call the notifyDataChange api to force an update.
12+
13+
For better performance with the following example, you can choose to load the ui-grid.core.js file instead:
14+
<pre>
15+
<script src="/release/ui-grid.core.min.js"></script>
16+
</pre>
1217

1318
@example
1419
<example module="app">

misc/tutorial/114_row_header.ngdoc

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
You can add a row header column, which goes into the left pinned container
66
(right pinned container on RTL implementations).
77

8+
For better performance with the following example, you can choose to load the ui-grid.core.js file instead:
9+
<pre>
10+
<script src="/release/ui-grid.core.min.js"></script>
11+
</pre>
12+
813
@example
914
<example module="app">
1015
<file name="app.js">

misc/tutorial/115_headerCellClass.ngdoc

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ A class name or function returning a class name can be assigned to each columnDe
77
In this example, we will set the font color of header column 0 to blue, and conditionally
88
set the background and foreground color of the header if the sort direction is ASC
99

10+
For better performance with the following example, you can choose to load the ui-grid.core.js file instead:
11+
<pre>
12+
<script src="/release/ui-grid.core.min.js"></script>
13+
</pre>
14+
1015
<example module="app">
1116
<file name="app.js">
1217
var app = angular.module('app', ['ngAnimate', 'ngTouch', 'ui.grid']);

misc/tutorial/117_tooltips.ngdoc

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ data that won't be displayable within the grid row (e.g. long description fields
3131

3232
Tooltips respect the cellFilter, so if you define a cellFilter it will also be used in the tooltip.
3333

34+
For better performance with the following example, you can choose to load the ui-grid.core.js file instead:
35+
<pre>
36+
<script src="/release/ui-grid.core.min.js"></script>
37+
</pre>
38+
3439
<example module="app">
3540
<file name="app.js">
3641
var app = angular.module('app', ['ngAnimate', 'ngTouch', 'ui.grid']);

misc/tutorial/120_RTL.ngdoc

+16-6
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,23 @@
44

55
The grid supports RTL languages
66

7+
For better performance with the following example, you can choose to load the ui-grid.core.js and specific feature files instead:
8+
<pre>
9+
<script src="/release/ui-grid.core.min.js"></script>
10+
<script src="/release/ui-grid.resize-columns.min.js"></script>
11+
<script src="/release/ui-grid.selection.min.js"></script>
12+
<script src="/release/ui-grid.pinning.min.js"></script>
13+
</pre>
14+
715
@example
816
<example module="app">
917
<file name="app.js">
1018
var app = angular.module('app', ['ngTouch', 'ui.grid', 'ui.grid.resizeColumns', 'ui.grid.selection', 'ui.grid.pinning']);
1119

12-
app.controller('MainCtrl', ['$scope', '$http', function ($scope, $http) {
13-
$scope.gridOptions = {
20+
app.controller('MainCtrl', function ($http) {
21+
var vm = this;
22+
23+
vm.gridOptions = {
1424
columnDefs: [
1525
{ name: 'field1', field: 'name', width: 200 },
1626
{ name: 'field2', field: 'gender', width: 200 },
@@ -32,13 +42,13 @@ The grid supports RTL languages
3242

3343
$http.get('/data/100.json')
3444
.then(function(response) {
35-
$scope.gridOptions.data = response.data;
45+
vm.gridOptions.data = response.data;
3646
});
37-
}]);
47+
});
3848
</file>
3949
<file name="index.html">
40-
<div ng-controller="MainCtrl">
41-
<div ui-grid="gridOptions" class="grid" dir="rtl" ui-grid-pinning ui-grid-resize-columns></div>
50+
<div ng-controller="MainCtrl as $ctrl">
51+
<div ui-grid="$ctrl.gridOptions" class="grid" dir="rtl" ui-grid-pinning ui-grid-resize-columns></div>
4252
</div>
4353
</file>
4454
<file name="main.css">

misc/tutorial/121_grid_menu.ngdoc

+7
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ In the meantime, you can override the height to fit with your application in you
4141
}
4242
</pre>
4343

44+
For better performance with the following example, you can choose to load the ui-grid.core.js and specific feature files instead:
45+
<pre>
46+
<script src="/release/ui-grid.core.min.js"></script>
47+
<script src="/release/ui-grid.exporter.min.js"></script>
48+
<script src="/release/ui-grid.selection.min.js"></script>
49+
</pre>
50+
4451
@example
4552
<example module="app">
4653
<file name="app.js">

misc/tutorial/122_accessibility.ngdoc

+7
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ Simply use the <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> keys to naviga
6060
<h2>Visualize Accessibility</h2>
6161
You can visualize the accessibility roles that have been applied to the grid using this simple little javascript tool: {@link http://khan.github.io/tota11y/}
6262

63+
For better performance with the following example, you can choose to load the ui-grid.core.js and specific feature files instead:
64+
<pre>
65+
<script src="/release/ui-grid.core.min.js"></script>
66+
<script src="/release/ui-grid.cellnav.min.js"></script>
67+
<script src="/release/ui-grid.pagination.min.js"></script>
68+
</pre>
69+
6370
@example
6471
<example module="app" deps="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.16/angular-aria.js">
6572
<file name="app.js">

0 commit comments

Comments
 (0)