【发布时间】:2013-12-27 21:08:31
【问题描述】:
我在 MVC 应用程序中使用 jqGrid。我正在使用"scroll: true" 选项。我的问题是;在特定页面上重新加载 jqGrid 后:
$("#jqTable").trigger("reloadGrid", [{ page: next_page }]);
我无法获得应该存在的新 ID:
var ids = $("#jqTable").getDataIDs();
编辑:
另外,我忘了说 reloadGrid 后我什至看不到下一页的行。
这里有更详细的解释:
有一个网页,我必须在 jquery 对话框中的 Enter 键上显示 jqgrid 中某些选定行的详细信息。我只用 Enter 键逐行遍历网格。首先输入 = 打开对话框。第二个输入是保存。因此,我必须根据客户的意愿标记当前行并选择下一行的代码是:
//declaration of global variables as selected_index -> current index of id in $("#jqTable").getDataIDs() array ...
//...
//In this moment jquery dialog is open. I work on jqgrid on underlying page:
//Set status of current row:
$("#" + selected_row_id).find("td").css("background-color", "azure");
$("#jqTable").jqGrid("setCell", selected_row_id, "Status", "Completed");
//Select next row:
selected_index = selected_index + 1;
temp_id = selected_row_id;
selected_row_id = $("#jqTable").getDataIDs()[selected_index];
if (selected_row_id === undefined) {
//If I am here it means that I have to jump to next page!
//Trying to simulate virtual scroll if id is undefined - because id is on the next page!
current_page = current_page + 1; // SO, IT IS NEXT PAGE!
$("#jqTable").trigger("reloadGrid", [{ page: current_page }]);
//Here selected_row_id is still undefined after this line of code:
selected_row_id = $("#jqTable").getDataIDs()[selected_index];
}
$("#jqTable").setSelection(selected_row_id, true);
【问题讨论】:
-
请提供更多代码和标记,至少发布您获得 ID 的代码/事件块
-
我会的。我是网站上的新手,所以我必须等待 8 小时才能收到新帖子...
-
您应该编辑现有问题,而不是创建新问题。
-
感谢马克西姆的小费!
-
请帮忙!我还没有解决方案。
标签: jquery asp.net-mvc jqgrid scroll