[英]jqGrid - Select selected cell's text while inline editing
我不確定所有版本的舊網絡瀏覽器,但是您可以將onSelectRow
的代碼修改為以下內容
onSelectRow: function (id) {
var $self = $(this);
if (id && id !== lastsel2) {
$self.jqGrid('restoreRow', lastsel2);
$self.jqGrid('editRow', id, {
keys: true,
focusField: 'Quantity',
oneditfunc: function (rowid, options) {
$control = $("#" + rowid + "_Quantity");
if ($control.length > 0) {
$control[0].select();
}
},
aftersavefunc: reload
});
lastsel2 = id;
}
}
參見http://jsfiddle.net/OlegKi/HJema/163/ 。 它使用focusField: 'Quantity'
選項將焦點設置在'Quantity'
列上。 它使用select()方法選擇<input>
字段的文本。
在我看來,您問題的第二部分(關於bindKeys
)是一個單獨的問題。 bindKeys
方法允許實現自定義回調onLeftKey
, onRightKey
。 對於我來說,您還想使用哪一種更好。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.