本文介绍了如何使用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
        });

现在此代码有效,如何在Web服务中传递参数?我尝试在Flexigrid api中查找数据"参数,但似乎没有.

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.

类似这样的东西:

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

推荐答案

我最终要做的是这个在flexigrid.js的第713行,我将其添加

what I ended up doing was this on line 713 of flexigrid.js i add this

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

然后我可以做这样的事情

then I could do something like this

 $('#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 ^

its not great but I really could find any other way and I don't see any new versions coming out anytime soon 8 ^ )

这篇关于如何使用Flexigrid在asmx中传递参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 23:06