jqgrid 警告 Synchronous XMLHttpRequest on the main

jqgrid The warning Synchronous XMLHttpRequest on the main

奥列格

与此相关 post

我刚刚意识到我不需要同时使用 serializeRowData 和 beforeSaveRow。我正在使用 jqGrid 4.7.1,单击 'Save' 图标时会显示 "Saving..." 消息。

但似乎只有 Firefox 运行良好(我的意思是显示 "Saving..." 消息),我的 Chrome 不工作(未显示 "Saving..." 消息)。 警告 "Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/." 显示在我的 Chrome 上。我认为这就是未显示 "Saving..." 消息的原因。

我认为 "Saving..." 消息是 jqgrid 的一个现有功能,我们不需要自定义消息或类似的东西。 (不需要同时使用 serializeRowData 和 beforeSaveRow)

所以,我的问题是为什么 Chrome 会触发上面的警告?

非常感谢

我建议你使用 jqGrid 的 ajaxRowOptions 选项来设置 async: true 选项:

ajaxRowOptions: { async: true }

主要区别在于saveRow方法不会return正确的值(truefalse),但该值将很少使用。只有jqGrid 4.inlineNavformatter: "actions"7.x使用returned值和hide/show/enable/disable相应的编辑按钮。如果您使用 inlineNavformatter: "actions",您只需要在回调句柄中添加一些额外的代码到 hide/show/enable/disable 相应的编辑按钮。

顺便说一下,我正在开发 new free version of jqGrid 并且已经重写了 inlineNavformatter: "actions" 的某些部分。更改编辑按钮状态的问题不再存在。因此,我今天将从我的存储库中的 saveRow 中删除行 async: false,以便它在默认情况下异步工作。