3

这是我的代码:

$('#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
        });

现在这段代码可以工作了,我如何在 web 服务中传递参数?我尝试在 Flexigrid api 中查找“数据”参数,但似乎没有。

像这样的东西:

            method: 'POST',
            url: '/services/MHService.asmx/GetSurgicalHistory',
            dataType: 'xml',
            data: '{ id: 23, area: "anywhere" }',
4

6 回答 6

4

改变:

data: '{ id: 23, area: "anywhere" }',

到:

params: [{name:'id', value: 23},{name:'area', value: 'anywhere'}],

或者,如果您想使用新选项重新加载:

$("#flex1").flexOptions({params: [{name:'id', value: 23},{name:'area', value: 'anywhere'}]}).flexReload();
于 2011-09-19T08:29:21.110 回答
3

可以使用 params: 选项指定其他参数。如果您查看 flexigrid.js 中的第 615-618 行,您可以看到代码在哪里循环遍历 p.params 中的每个项目,并将其添加到默认列表(页面、rp、排序名称等)。

于 2010-12-08T21:47:40.607 回答
2

我最终在 flexigrid.js 的第 713 行添加了这个

            for(opt in p.optional){
              param[param.length] = {name:opt,value:p.optional[opt]};
            }

然后我可以做这样的事情

 $('#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,
        optional: { id: 23, area: "anywhere" }
    });

它不是很好,但我真的可以找到任何其他方式,而且我看不到任何新版本很快就会出现 8 ^)

于 2010-08-06T15:19:25.320 回答
1

你应该在这里试试这个:

http://bargaorobalo.net/blog/flexigrid-passar-parametros

它是葡萄牙语,但意味着您将附加参数传递给 json:

useRp   : true,
rp  : 10,
params: [{name:'ID', value: 100}]

并在 json 设置变量中接收:

$query     = isset($_POST['query'])     ? $_POST['query']    : false;
$qtype     = isset($_POST['qtype'])     ? $_POST['qtype']    : false;
$id = isset($_POST['ID']) ? $_POST['ID'] : NULL;

现在,您只需在 SQL 代码中使用此参数:

$sql = "SELECT * FROM PROCEDURE_NAME(".$id.") $where $sort $limit";
$result = runSQL($sql);
于 2012-03-28T14:46:37.157 回答
0

如果您尝试在某些单击事件中为特定值加载 flexigrid 数据。试试这个,我们可以像使用查询字符串一样

 var val1=value;
    url: '/services/MHService.asmx/GetSurgicalHistory?qurid='+val1,

到 webservice 方法并使用字符串从 webservice 获取

getvalue=HttpContext.Current.Request.QueryString["qurid"].ToString();

于 2011-12-29T12:25:58.317 回答
0

初始化 flexigrid 时,可以在 onSubmit 事件中使用 flexOptions,如下所示:

...
title: 'Surigcal History',
onSubmit: function() {  
  $('#flex1').flexOptions({newp:1,params:[{name: 'id', value: '23'}]});
  $('#flex1').flexOptions({newp:1,params:[{name: 'area', value: 'anywhere'}]});
},
useRp: true,
...

更好地为多个参数使用循环

这样可以避免直接修改 flexigrid.js

于 2013-02-18T21:34:19.390 回答