我在一个页面中使用两个jqgrids.我使用的第二个网格,loadonce: true因为我需要在第二个网格中进行列排序.我需要在服务器回发后重新加载两个网格.(需要在第二个网格中显示更新的值).第一个网格重新加载很好,因为它不会使用该loadonce属性.我的问题是我们可以一起使用loadonce属性reloadGrid吗?(通过loadonce动态设置属性到网格)或者在这种情况下我是否需要进行服务器端排序?请指教.提前致谢.
什么是在网格中显示实时数据(证券交易所,天气......)的更好方法?
我用这个方法:
setInterval(function(){
jQuery("#list1").trigger('reloadGrid');
}, 5000);
Run Code Online (Sandbox Code Playgroud) 我们在网格上使用loadonce设置为true 的jqGrid导航器重新加载按钮.
重新加载按钮当前不会返回到服务器以获取数据 - 我们如何才能将重新加载到服务器以获取最新数据?
我相信我们可以利用beforeRefresh回调设置网格data来json代替local,但我不清楚如何,即使配置beforeRefresh方法-我真的不明白的文档.
我有一个带有loadonce的JQGrid:true(所以它是所有客户端)和启用分页(有20页).
我想指定一行(以编程方式,没有用户输入)并让我的网格导航到相应的页面以选择指定的行.
这可能与当前的JQGrid有关吗?
我已经研究过搜索和过滤,但只是用新行重新加载网格 - 我需要我的网格导航到正确的页面 - 保持其数据和结构.
我正在优化我的网格结构,因此所需的任何更改(例如客户端到服务器端)都是可能的.
这里似乎有一些关于这个问题的问题,他们有一些很好的答案,但似乎我的情况有点不同.我需要过滤jqGrid中显示的记录,但完全是客户端.
出于多种原因,我填充网格的最佳方法是使用直接发送到页面上的JavaScript的数组.网格本身根本不与服务器交互.我在各种网格事件中都有一些自定义的AJAX,但就是这样.(基本上,我将其与现有的一组服务相结合,这些服务不会发生重大变化.)
我想要做的是根据简单的文本输入和按钮过滤网格.我的页面有文本输入,按钮和表格(在文档就绪时成为网格).我想绑定到按钮的click事件(正常的jQuery事件绑定,没什么特别的),并使用文本输入中的值作为jqGrid上的显示过滤器.
"过滤器"是指仅显示包含输入中文本的匹配(在任何字段中)的记录.然后,要显示所有记录,只需清空输入并再次单击该按钮.此外,网格是多选的,选择需要通过过滤保持.我只需要能够隐藏与输入中的行不匹配的行.
这可能吗?
我从模型类生成我的jqgrid,我将其传递给视图.我得到了构建和工作jqgrid.但是,在我调用helper创建jqgrid之后,我想在一个视图上设置postData,在那里我使用jqGrid,在该视图中使用脚本,而不必更改创建jqgrid的整个局部视图.
我试过跑步
$("#@Model.Id").jqGrid('setGridParam', { postData: { test: 233} });
Run Code Online (Sandbox Code Playgroud)
和
$("#@Model.Id").setGridParam({ postData: { test: 233} });
Run Code Online (Sandbox Code Playgroud)
但没有错误或任何结果.如果我在jqgrid参数中设置postData(在部分视图中构造它,它可以工作.
我还检查了网格存在,补充说
console.log($("#@Model.Id").size());
Run Code Online (Sandbox Code Playgroud)
在第一行之前,它显示1.
更新:这个.setGirdParam函数开始为我工作没有明显的原因,所以如果有人可以提供一些可以阻止这种工作的见解,我会接受回答.谢谢
我有一个基于jqGrid的应用程序,我用loadonce: true在网格选项,并sortable: true, sorttype: 'text在colModel允许客户端排序的数据网格.但是,我发现,一旦数据网格重新排序,最后选择的行将不再突出显示.我的问题是,如何保持所选行在数据处理中突出显示?
我是jqGrid的首发,我在页面中有2个jqGrid,在Grid1中我有inCustom和OutCustom我希望用户点击Grid获取Data inCustom和outCustom来编写这段代码
var grid = $('#list');
grid.jqGrid({
url: 'jQGridHandler.ashx',
postData: { ActionPage: 'ClearanceRequest', Action: 'Fill' },
ajaxGridOptions: { cache: false },
loadonce: true,
direction: "rtl",
datatype: 'json',
height: 600,
width: 1000,
colNames: ['', '', '', ' ', '', '', '', '', '',
'', '', ' ', '', '', '', '', '', '',
'', ' ', '', '', '', '',
'', '', '', '', '', '', ' ',
'', '', '', '', '', ''],
colModel: [
{ name: 'REQUEST_ID', width: 100, …Run Code Online (Sandbox Code Playgroud) 我是使用jqgrid的新手.
在新页面加载时,网格正在从数据库中正确加载数据.之后由于loadonce:true,网格没有从数据库重新加载数据以进行添加/编辑/删除.
我的应用程序组合是JSP,Servlet,MySQL
我有一个具有以下设置的网格
jQuery("#userList").jqGrid({
url: '<%=request.getContextPath()%>/userJqGrid?q=1&action=fetchData&userCookie=<%= encodedCookie%>',
datatype: 'xml',
mtype: 'GET',
colNames:['<%= userProp.getProperty(userColNames[0])%>',
'<%= userProp.getProperty(userColNames[1])%>',
'<%= userProp.getProperty(userColNames[2])%>',
'<%= userProp.getProperty(userColNames[3])%>',
'<%= userProp.getProperty(userColNames[4])%>',
'<%= userProp.getProperty(userColNames[5])%>'
],
colModel:[
{name:'<%= userColNames[0]%>',index:'<%= userColNames[0]%>',
width:120,sortable:true,editable:true,editrules:{required:true},formoptions:{rowpos:1, elmprefix:'*'}},
{name:'<%= userColNames[1]%>',index:'<%= userColNames[1]%>',
width:130,sortable:true,editable:true},
{name:'<%= userColNames[2]%>',index:'<%= userColNames[2]%>',
width:100,sortable:true,editable:true,editrules:{required:true},formoptions:{rowpos:3, elmprefix:'*'}},
{name:'<%= userColNames[3]%>',index:'<%= userColNames[3]%>',
width:180,sortable:true,editable:true,editrules:{email:true,required:true},formoptions:{rowpos:4, elmprefix:'*'}},
{name:'<%= userColNames[4]%>',index:'<%= userColNames[4]%>',
width:100,sortable:true,editable:true},
{name:'<%= userColNames[5]%>',index:'<%= userColNames[5]%>',
width:100,sortable:true,editable:true},
],
pager: '#pager1',
rowNum:50,
height:'auto',
//rowList:[10,20,30],
loadonce: true,
sortname:'<%= userColNames[0]%>',
viewrecords: true,
editurl:'<%=request.getContextPath()%>/userJqGrid?q=1&action=addData&userCookie=<%= encodedCookie%>',
caption: 'User Grid',
ondblClickRow: function(rowid) {
$("#userList").jqGrid('editGridRow',rowid, userEditParam);
return;
}
});
$("#userList").jqGrid('navGrid',"#pager1",{add:true,edit:true,del:true});
$("#userList").jqGrid('gridResize', …Run Code Online (Sandbox Code Playgroud) 我遇到了Jqgrid的问题,我在一个页面上有两个网格,并且在第一个网格的一行上点击需要重新加载第二个网格.
我100%确定第二个网格配置正确,如果我手动传递一个硬编码的ID它正确填充.
只是重装功能不起作用.请有人帮忙.下面是两个网格的jquery代码
$(document).ready(function() {
jQuery("#list2").jqGrid({
url:'classes/ListServices.php',
datatype: "json",
mtype: 'POST',
colNames: ['Id','Description', 'Details', 'Cost in (R)'],
colModel: [
{name:'Id',index:'Id', align:"center", width:30},
{name:'Description',index:'Description', align:"center"},
{name:'Details',index:'Details', align:"left"},
{name:'Cost',index:'Cost',align:"center",width:30,formatter:'currency'},
],
width: 780,
height: 100,
rowNum:18,
pager: '#pager1',
loadonce: true,
sortname: 'id',
viewrecords: true,
sortorder: "asc",
caption:"Services List",
multiselect: false,
onSelectRow: function(ids) {
if(ids == null) {
ids=0;
if(jQuery("#list3").jqGrid('getGridParam','records') >0 ) {
jQuery("#list3").jqGrid('setGridParam',
{url:"subgrid.php?q=1&id="+ids,page:1});
jQuery("#list3").jqGrid.trigger('reloadGrid');
}
}
else {
jQuery("#list3").jqGrid('setGridParam',
{url:"subgrid.php?q=1&id="+ids,page:1});
jQuery("#list3").jqGrid.trigger('reloadGrid');
}
}
});
jQuery("#list2").jqGrid('navGrid','#pager2',
{edit:false,add:false,del:false,multipleSearch:true});
jQuery("#list2").jqGrid('filterToolbar',
{stringResult: true,searchOnEnter : false});
jQuery("#list3").jqGrid({ …Run Code Online (Sandbox Code Playgroud) 问题在标题中几乎完成:有没有办法,使用jquery,找到由jqGrid对象处理的元素?
更确切地说,我希望在网格上调用重新加载方法(如果页面上有一个方法).我使用以下代码
...
success: function (data) {
//Check if there is a jqGrid on the page and if present, reloads its data
var jqGrid = $('.ui-jqgrid');
if ( jqGrid.length ) {
//get the grid id. The actual id object is in the form of "gbox_your_grid_id"
var gridid = "#" + jqGrid.attr('id').substring(5);
//time to reload
$(grid).trigger('reloadGrid');
}
}
Run Code Online (Sandbox Code Playgroud)
但似乎永远不会调用reloadGrid方法.有什么建议吗?