|
- <script type="text/javascript">// <![CDATA[
- var gridClientID = '<%= GridList.ClientID %>';
- function registerSelectEvent() {
- var grid = X(gridClientID);
- // 防止重复注册客户端事件
- if (grid.el.getAttribute('data-event-click-registered')) {
- return;
- }
- grid.el.set({ 'data-event-click-registered': true });
- grid.el.select('.x-grid-tpl input').on('click', function (evt, el) {
- el.select();
- });
- }
- function registerEnterEvent() {
- var grid = X(gridClientID);
- // 防止重复注册客户端事件
- if (grid.el.getAttribute('data-event-keydown-registered')) {
- return;
- }
- grid.el.set({ 'data-event-keydown-registered': true });
- grid.el.select('.x-grid-tpl input').on("keydown", function (evt, el) {
- if (evt.getKey() == evt.ENTER) {
- var currRow = Ext.get(el).parent('.x-grid3-row');
- var currCell = Ext.get(el);
- var currIndex = currRow.query('.x-grid-tpl input').indexOf(currCell.dom);
- var nextRow = Ext.get(el).parent('.x-grid3-row').next();
- if (nextRow) {
- nextRow.query('.x-grid-tpl input')[currIndex].select();
- }
- }
- });
- }
- function onReady() {
- var grid = X(gridClientID);
- grid.on('viewready', function () {
- registerSelectEvent();
- registerEnterEvent();
- });
- }
- function onAjaxReady() {
- registerSelectEvent();
- registerEnterEvent();
- }
- // ]]></script>
复制代码
|
|