dgrid定制左下角描述信息

今天发现dgrid有定制左下角描述信息的代码,看了之后,感觉写的很正确,有种恍然大悟的感觉,今天在这里分享出来,也做个笔记。

位置在dgrid\test\extensions\Pagination_i18n.html。

<!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>

注意到里面的
"dojo/i18n!dgrid/extensions/nls/pagination"

或许可以应用到enhancedGrid上面。这个暂时先不测试。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值