-
Notifications
You must be signed in to change notification settings - Fork 295
/
Pagination_i18n.html
61 lines (58 loc) · 2.06 KB
/
Pagination_i18n.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test Pagination Extension with i18n override</title>
<meta name="viewport" content="width=570">
<style>
@import "../../../dojo/resources/dojo.css";
@import "../../css/dgrid.css";
@import "../../css/skins/claro.css";
.heading {
font-weight: bold;
padding-bottom: 0.25em;
}
.dgrid {
width: 750px;
margin: 10px;
}
</style>
<script src="../../../dojo/dojo.js"
data-dojo-config="async: true"></script>
<script>
require(["dgrid/Grid", "dgrid/extensions/Pagination",
"dojo/i18n!dgrid/extensions/nls/pagination", "dgrid/Selection", "dgrid/Keyboard",
"dojo/_base/lang", "dojo/_base/declare", "dojo/dom-construct", "dojo/dom-form",
"dgrid/test/data/createAsyncStore", "dgrid/test/data/genericData", "dojo/domReady!"],
function(Grid, Pagination, i18nPagination, Selection, Keyboard,
lang, declare, domConstruct, domForm, createAsyncStore, genericData){
// Create a custom Pagination class with a distinct i18n bundle
// In this case, we're overriding just one value, so we're
// loading the original one to serve as a basis
var i18nCustomized = lang.mixin({}, i18nPagination, {
status: "Total: ${total} - Showing from ${start} to ${end}"
});
var MyPagination = declare(Pagination, {
i18nPagination: i18nCustomized
});
// Create our custom grid using MyPagination
var CustomGrid = declare([Grid, Keyboard, Selection, MyPagination]);
window.grid = new CustomGrid({
collection: createAsyncStore({ data: genericData }),
columns: {
col1: 'Column 1',
col2: {label: 'Column2', sortable: false},
col3: 'Column 3',
col4: 'Column 4',
col5: 'Column 5'
}
}, "grid");
});
</script>
</head>
<body class="claro">
<h2>A paginated grid with custom i18n</h2>
<p>Assuming success, the status in the lower left should read "Total: 100 - Showing from 1 to 10"</p>
<div id="grid"></div>
</body>
</html>