如何使用 Flexigrid 在 asmx 中传递参数?
这是我的代码:
$('#flex1').flexigrid({
method: 'POST',
url: '/services/MHService.asmx/GetSurgicalHistory',
dataType: 'xml',
colModel: [
{ display: 'Surgical Procedure', name: 'SurgicalProcedure', width: 120, sortable: true, align: 'left' },
{ display: 'Notes', name: 'Notes', width: 120, sortable: true, align: 'left' },
{ display: 'Complications', name: 'Complications', width: 120, sortable: true, align: 'left' }
],
searchitems: [
{ display: 'Surgical Procedure', name: 'SurgicalProcedure' },
{ display: 'Notes', name: 'Notes' },
{ display: 'Complications', name: 'Complications' }
],
sortname: 'SurgicalProcedure',
singleSelect: true,
sortorder: 'asc',
usepager: true,
title: 'Surigcal History',
useRp: true,
rp: 10,
showTableToggleBtn: true,
width: 805,
height: 200
});
现在这个代码可以工作了,我如何在网络服务中传递参数?我尝试在 Flexigrid api 中查找“data”参数,但似乎没有。
像这样的东西:
method: 'POST',
url: '/services/MHService.asmx/GetSurgicalHistory',
dataType: 'xml',
data: '{ id: 23, area: "anywhere" }',
here's my code:
$('#flex1').flexigrid({
method: 'POST',
url: '/services/MHService.asmx/GetSurgicalHistory',
dataType: 'xml',
colModel: [
{ display: 'Surgical Procedure', name: 'SurgicalProcedure', width: 120, sortable: true, align: 'left' },
{ display: 'Notes', name: 'Notes', width: 120, sortable: true, align: 'left' },
{ display: 'Complications', name: 'Complications', width: 120, sortable: true, align: 'left' }
],
searchitems: [
{ display: 'Surgical Procedure', name: 'SurgicalProcedure' },
{ display: 'Notes', name: 'Notes' },
{ display: 'Complications', name: 'Complications' }
],
sortname: 'SurgicalProcedure',
singleSelect: true,
sortorder: 'asc',
usepager: true,
title: 'Surigcal History',
useRp: true,
rp: 10,
showTableToggleBtn: true,
width: 805,
height: 200
});
Now this code works, how do i pass parameters in the webservice? i tried looking for the 'data' parameter in the Flexigrid api, but there seems to be none.
something like this:
method: 'POST',
url: '/services/MHService.asmx/GetSurgicalHistory',
dataType: 'xml',
data: '{ id: 23, area: "anywhere" }',
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
更改:
为:
或者如果您想使用新选项重新加载:
Change:
to:
Or if you want to reload with new Options:
可以使用 params: 选项指定其他参数。如果查看 flexigrid.js 中的第 615-618 行,您可以看到代码在 p.params 中循环每个项目的位置,并将其添加到默认列表(page、rp、sortname 等)。
Additional parameters can be specified using the params: option. If you look at line 615-618 in flexigrid.js, you can see where the code loops through each item in p.params, and adds it to the default list (page, rp, sortname, etc).
我最终做的是这个
在 flexigrid.js 的第 713 行上,我添加了这个
,然后我可以做这样的事情,这
不是很好,但我真的可以找到任何其他方法,而且我没有看到任何新版本很快就会出现 8 ^ )
what I ended up doing was this
on line 713 of flexigrid.js i add this
then I could do something like this
its not great but I really could find any other way and I don't see any new versions coming out anytime soon 8 ^ )
您应该在这里尝试一下:
http://bargaorobalo.net/blog/flexigrid-passar-parametros
它是葡萄牙语,但意味着您将附加参数传递给 json:
并在 json 设置变量中接收:
现在,您只需在 SQL 代码中使用此参数:
You should try this here:
http://bargaorobalo.net/blog/flexigrid-passar-parametros
Its in portuguese, but means that you PASS additionals parameters to json:
and RECEIVE in json setting variable:
Now, you just use this parameter in your SQL CODE:
如果您尝试在某些单击事件中加载特定值的 Flexigrid 数据。试试这个
一样使用查询字符串
我们可以像webservice 方法
,并使用字符串getvalue=HttpContext.Current.Request.QueryString["qurid"].ToString(); 从 webservice 获取
if you try to load flexigrid data for a particular value in some click Event. try this
we can use the query string like a
to the webservice method and get from webservice using string
getvalue=HttpContext.Current.Request.QueryString["qurid"].ToString();
初始化flexigrid时,您可以在onSubmit事件中使用flexOptions,如下所示:
最好对多个参数使用循环
这可以避免直接修改flexigrid.js
You can use the flexOptions in the onSubmit event when initializing flexigrid, like this:
better to use a loop for multiple parameters
This avoids modifying the flexigrid.js directly