- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 jqGrid 和 OnSelectRow 函数来编辑网格中的行。当我在行上选择时,我选择的单元格将获得焦点,在 Firefox 上,当我尝试单击同一行中的另一个单元格时,它不会绘制焦点。我要么需要按 Tab 键找到它,要么选择我们的行并返回到它。
它在 Chrome 中运行良好。
这是代码:
gridElement.jqGrid({
url: $.url("/MyURL"),
postData: {
ID: function () { return $('#IDVAL').val(); }
},
datatype: "json",
mtype: "POST",
colNames: ['Name', 'Numbers', 'Options', 'TextBox', 'Hide'],
colModel: [
{ name: 'Name', index: 'Name', width: 200, hidden: false },
{ name: 'Numbers', index: 'Type', width: 120, editable: true, edittype: "select", editoptions: { value: { 0: 'None', 1: 'One', 2: 'Two' }, dataInit: function (elem) { $(elem).width(85); } } },
{ name: 'Options', index: 'Summary', width: 120, editable: true, edittype: "select", editoptions: { value: { 0: 'None', 1: 'Option 1', 2: "Option 2" }, dataInit: function (elem) { $(elem).width(85); } } },
{ name: 'TextBox', index: 'TextBox', width: 300, edittype: "text", editable: true, editoptions: { size: "50", maxlength: "100"} },
{ name: 'Hide', index: 'Hide', width: 80, editable: true, edittype: "checkbox", editoptions: { value: "true:false"} }
],
rowNum: 50,
width: 800,
height: "auto",
loadtext: "Please wait...",
viewrecords: true,
hidegrid: false,
onSelectRow: function (id) {
if (id && id !== lastselref) {
gridElement.saveRow(lastselref, false, 'clientArray', '');
gridElement.jqGrid('restoreRow', lastselref);
gridElement.jqGrid('editRow', id, true);
lastselref = id;
}
},
forceFit: true
});
最佳答案
您的代码中有一些奇怪的部分,我建议您进行更改,但首先我想指出您所关注的问题。
问题是 jqGrid 首先搜索该行中第一个可编辑单元格的索引(参见 the line ),然后仅将其设置为 <input>
跳过 <select>
的单元格元素您拥有的(请参阅 the line ):
setTimeout(function(){$("td:eq("+focus+") input",ind).focus();},0);
例如可以修复以下内容
setTimeout(function(){$("td:eq("+focus+") :input:visible",ind).focus();},0);
其中伪选择器:input和 :visible将像 jqGrid 代码的许多其他地方一样使用。
The demo可用于重现您的问题(只需单击一行并尝试使用箭头按钮来查看焦点未设置在编辑行中的选择元素上)和 another demo使用过the fixed code jqGrid 的。
我报告了该错误和我的建议:the following pull request .
对您的代码的一些其他小注释:
name
的不同值和index
colModel
的属性( name: 'Numbers', index: 'Type'
和 name: 'Options', index: 'Summary'
)。如果您确实需要用于服务器端排序 index
other 作为输入数据中的属性名称,那么最好使用 jsonmap
而不是名字。例如name: 'Type', index: 'Type', jsonmap: 'Numbers'
。一般来说,我建议不要使用 index
属性(property)根本。在这种情况下,值 name
将使用属性:name: 'Type', jsonmap: 'Numbers'
.loadonce: true
因为你没有那么多的数据总行数。gridview: true
提高网格性能的选项(请参阅 the answer )autoencode: true
强制 jqGrid 将输入数据解释为文本而不是 HTML 片段的选项。更新: The pull request我发布的内容已经合并到jqGrid的主要代码中。因此,上述更改( "td:eq("+focus+") input"
到 "td:eq("+focus+") :input:visible"
)将出现在 jqGrid 的下一个版本中。
关于jquery - jqGrid - OnSelectRow 可编辑字段不关注 Firefox 中的单击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24632858/
众所周知,jQuery 的 $.post 函数非常棒,但我遇到的问题是查看页面源代码的人可以查看数据的去向,从而移向该页面进行窥探,或者,上帝禁止找到保存所有内容的文件夹。所以我的问题是,谁知道如何隐
我在下面有这个程序,它执行简单的关注/取消关注功能。一切都很好,除了当我刷新页面时,只有行中的第一个用户保留正确的关注/取消关注按钮。示例 我可以关注 user1 user2 和 user3,但是当我
我想要创建的是一个关注者/关注系统,您不是简单地关注用户,而是关注他们共享的内容部分。几乎就好像您关注的是 Twitter 的“列表”或群组而不是人员。不过,有了这个,您就可以关注/取消关注用户共享的
这个问题已经有答案了: facebook social plug-in not showing up when added dynamically (2 个回答) 已关闭 7 年前。 使用 HTML
我正在构建一个编辑器,它使用 TImage 来显示图片,并具有鼠标事件来能够在图像上绘制、移动框和调整框大小。这一切都很完美。现在我正在尝试实现使用键盘上的箭头移动选定框的功能,但是A)TImage没
我有两个问题,请记住我是一个java新手1.我有一个使用 JFrame 创建 GUI 的类。JFrame 有 2 个面板,我使用 JSplitPane 添加了 问题是我可以设法将焦点设置在所需的 JP
我目前正在使用iOS应用程序进行开发,该应用程序会从流式API捕获一些推文。因此,我使用用户名和密码进行身份验证。除此之外,我想给用户提供在Twitter上关注某些人的机会。我创建了一个UIButto
有没有办法钩入Play evolutions framework这样当它成功从 n.sql 迁移时至 n+1.sql至 n+2.sql ...,它在 Play 应用程序中调用了一些成功后 Hook (
我的 gorm 中有文本模式为多行的文本框。我必须通过 jQuery 将 css 应用到该文本框。为此,我使用了以下脚本。 $(document).ready(function() {
我在强制关注动态生成的 JQuery 对话框内容中的文本字段时遇到问题。我已经在 google 上搜索过这一点,似乎如果 Jquery 对话框设置为模式,JQuery 将“窃取”文档级别的焦点。老实说
下午,我正在使用 PHP、HTML5 和 Bootstrap。我构建了一个分为 5 个选项卡的表单,该表单中有几个必填字段。所有必需的输入字段都是“文本”,并且还标有 required="requir
我创建了一个带有 GridView 的 WPF 页面。在 GridView 中,每行有 5 个可用的 TextBox。当我在第一行的第一个 TextBox 上输入数据,然后按 Tab 键时,焦点移动到
请给我Java中密码验证的正则表达式代码,它应该由一个大写字符、一个整数、一个后面的符号(@、#、$、%、^、&、+、=)和小字符组成。 我一直在尝试使用不同的独立正则表达式和一个组合的正则表达式。
我想在我的 mean-stack 网页上添加一个 Twitter 的关注按钮。我使用以下代码: https://jsbin.com/herikik/3/edit?html,output 在 Ma
在下添加如下代码后到我在 Tumblr 上的主题 .tail { position:fixed; bottom:0px; right:0px; margin-bottom:434px; margin-
我必须从 Angular 应用程序启动一系列窗口。我希望能够让用户单击主页上的按钮以使该窗口重新成为焦点。通常我会在 javascript 中使用类似以下内容来执行此操作: //Launch the
因此,我想显示一些用 AND 或 OR 连接的规则,并且我想为 AND 或 OR 添加颜色,如红色、绿色等。 Fruit = Apple AND Market = SuperMarket1 那么我应该
我正在开发 Windows 商店应用程序,我正在使用 ListView 控件动态添加数据。这些项目被添加到列表的末尾。 Scrollbar 在添加更多数据时出现。我想用底部的滚动条以编程方式突出显示最
(问题仅在 Ubuntu 中出现。在 Windows 中工作正常。我不知道在其他 Linux 环境中) 我已经使用 ComponentListener 的方法在对话框中调用 JTextField 中的
如何将焦点放在时间选择器元素上?我正在开发电视应用程序,因此需要远程操作。所以我需要关注每个元素。TimePicker 有 3 个元素 - 小时列、分钟列和 AM/PM 列。 那么我如何才能专注于这
我是一名优秀的程序员,十分优秀!