FineUI 官方论坛
标题:
FineUI模板列自动下一行文本框代码
[打印本页]
作者:
shiningrise
时间:
2013-12-10 11:27
标题:
FineUI模板列自动下一行文本框代码
<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>
复制代码
作者:
shiningrise
时间:
2013-12-10 11:28
扩展这个demo
http://fineui.com/demo/grid/grid_edit.aspx
欢迎光临 FineUI 官方论坛 (https://fineui.com/BBS/)
Powered by Discuz! X3.4