连续GridUnload createGrid无法正常工作 [英] Consecutive GridUnload createGrid not working
问题描述
任何想法为何多次调用执行以下操作的函数
Any ideas why multiple calls to a function that does the following
grid.jqGrid('GridUnload');
createGrid();
每隔一次只会创建一个网格,但是...
Will only create the grid every other time, but ...
以下内容将在每次被调用时起作用:
The following will work everytime it is called:
grid.jqGrid('GridUnload');
setTimeout(createGrid, 1000);
推荐答案
您没有包含createGrid
的代码,因此我只能猜测.一种可能的原因是您在内部使用了grid
变量.如果使用GridUnload
,则将删除旧的<table>
元素,并将在同一位置创建另一个元素.因此,应在调用GridUnload
之后重新设置grid
的值:
You don't included the code of createGrid
so I can only guess. One possible reason is that you use grid
variable inside. If you use GridUnload
the old <table>
element will be deleted and another one will be created on the same place. So you should reset the value of grid
after call of GridUnload
:
var gridId = grid[0].id; // or grid.attr('id');
grid.jqGrid('GridUnload');
grid = $('#' + $.jgrid.jqID(gridId)); // or just $('#' + gridId);
createGrid();
仅当网格的id
可以容纳某些$.jgrid.jqID "nofollow">元字符.
The method $.jgrid.jqID
you have to use only if the id
of the grid can hold some meta-character.
这篇关于连续GridUnload createGrid无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!