我希望用户能够在不使用内在搜索框的情况下过滤网格数据.
我为date(from和to)创建了两个输入字段,现在需要告诉网格将其作为过滤器,然后请求新数据.
伪造网格数据的服务器请求(绕过网格)并将网格数据设置为响应数据不会起作用 - 因为一旦用户尝试重新排序结果或更改页面等,网格将请求新数据从服务器使用空白过滤器.
我似乎无法找到网格API来实现这一点 - 有没有人有任何想法?谢谢.
我试图用来自Web服务的数据填充jqGrid.我已经彻底查看了jqGrid代码和文档.我需要另一组眼睛来查看下面的代码并告诉我是否遗漏了一些东西.
正如您在代码中看到的那样,我将网格设置为在页面加载或刷新期间加载.网格加载后,我进行Ajax调用以获取JSON数据(再次)并显示在网格下方的div中.
我看到了大部分预期的行为.页面加载后,网格显示加载指示符,然后启动Ajax调用,并在网格下方显示JSON数据.问题是网格完全是空的.列标题是正确的,但网格正文中没有数据.
这是代码:
$(document).ready(function () {
$('#resultDiv').html('');
$('#waitIndicator').hide();
$("#list").jqGrid({
datatype: 'json',
url: 'WeatherDataService.svc/GetWeatherData',
jsonReader: {
root: "Rows",
page: "Page",
total: "Total",
records: "Records",
repeatitems: false,
userdata: "UserData",
id: "StationId"
},
loadui: "block",
mtype: 'GET',
rowNum: 10,
rowList: [10, 20, 30],
viewrecords: true,
colNames: ['Station ID', 'Station Name', 'Timestamp', 'Max Temp',
'Min Temp', 'Precipitation', 'Snowfall', 'SnowDepth'],
colModel: [
{ name: 'StationId', index: 'StationId' },
{ name: 'StationName', index: 'StationName' },
{ name: 'Timestamp', index: 'Timestamp', align: 'right' },
{ name: …Run Code Online (Sandbox Code Playgroud) 我已经能够使用jQuery/Ajax从Web服务中将数据从我的数据库中提取到jQGrid中.现在我想将添加/编辑的数据发送回Web服务.我通过使用PHP和editurl:命令看到了一些例子.这也适用于Web服务(就像我最初下载数据一样)?
我已多次查看这些例子了.我甚至发现了另一个类似于我所问的问题,我无法找到任何关于如何做我需要的实例.有存在吗?
:更新:
jQuery(document).ready(function () {
jQuery("#list").jqGrid({
datatype: processrequest,
mtype: 'POST',
jsonReader: {
root: "ListExercise", //arry containing actual data
page: "Page", //current page
total: "Total", //total pages for the query
records: "Records", //total number of records
repeatitems: false,
id: "ID" //index of the column with the PK in it
},
colNames: ['Id', 'Exercise'],
colModel: [
{ name: 'exercise_id', index: 'exercise_id',editable:false },
{ name: 'exercise_value', index: 'exercise_value',editable:true }
],
caption: 'MyFitnessApplication',
pager: '#pager',
rowNum: 10,
rowList: [10, 20, 30], …Run Code Online (Sandbox Code Playgroud)