问题描述
每当我在JqGrid上调用trigger("reloadGrid")时,它都会清除现有表,显示正在加载"消息,然后重新生成现有数据-整个过程只需要几毫秒,但是它使用户如果经常发生这种情况,界面会变得粗糙.是否可以阻止它清除并显示加载消息,而仅用最新的dta替换?
Whenever I call trigger("reloadGrid") on a JqGrid, it clears the existing table, displays a "loading" message, and then regenerates the existing data - the whole process just takes a few milliseconds, but it makes the user interface feel unpolished if it happens a lot. Is it possible to stop it from clearing and showing the loading message, and just replace with the latest dta?
推荐答案
不幸的是,jqGrid在进行AJAX调用之前清除了表的内容,因此只要它在等待答案,表就为空.
Unfortunately jqGrid clears out the contents of the table before making the AJAX call, so as long as it's waiting for an answer, the table is empty.
如果您使用固定高度的表进行滚动显示,则问题不大,但是在大多数情况下,我的表相当短,宁愿一次显示全部内容,也可以根据需要向下滚动页面.每次加载表时,以下调整将最小高度值应用于每个表周围的包装div(需要从gridInitialized()
调用):
This is less of an issue if you use a fixed-height table with scrolling, but in most cases I have fairly short tables and prefer to display the full contents at once and just scroll down on the page as necessary. The following tweak applies a min-height value to the wrapper div around each table each time the table is loaded (this needs to be called from gridInitialized()
):
function freezeHeight() {
var $tableWrapper = getContainer($grid).find(".ui-jqgrid-bdiv");
$tableWrapper.css("min-height", $tableWrapper.outerHeight());
}
这篇关于是否可以阻止JqGrid在重新加载时闪烁?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!