0

I am trying to pass parameter(s) to a web service call to flexigrid.

I have setup the FlexiGrid to work just fine except when i try to pass one parameter to my web service call, but am seeing 500 Internal Server Error when trying to load the grid with that one parameter.

Ideally, when the user clicks submit it then calls a javascript function to invoke the ajax call to flexigrid, but that I where I am seeing the 500 Internal Server Error in firebug.

It is saying the lastName parameter was missing from the web service call. This parameter is obtained from the last name search textbox.

Any help is appreciated since I am a newbie to FlexiGrid.

Here is my ajax call:

$("#userflexiGrid").flexigrid({
    url: 'FlexiGridService.asmx/GetDirectory',
    params: [{ name: 'lastName', value: 'doe'}],
    dataType: 'xml',
    colModel: [
            { display: 'Id', name: 'Employeeno', width: 30, sortable: true, align: 'left' },
            { display: 'Name', name: 'Employee', width: 130, sortable: true, align: 'left' },
            { display: 'Bureau', name: 'Bureau', width: 180, sortable: true, align: 'left' }
            ],
    searchitems: [
            { display: 'Name', name: 'Employee' },
            { display: 'Bureau', name: 'Bureau' },
            ],
    sortname: "Name",
    sortorder: "asc",
    usepager: true,
    title: 'Flexi Users',
    useRp: true,
    rp: 20,
    showTableToggleBtn: false,
    pagestat: 'Displaying: {from} to {to} of {total} matches.',
    //width: 700,
    singleSelect: true,
    onSubmit: addFormData,
    height: 260
});
competent_tech
  • 44,465
  • 11
  • 90
  • 113
tony
  • 1
  • 1
  • 2

3 Answers3

0

You can use the flexOptions in the onSubmit event like this:

onSubmit: function() { 
$('#userflexiGrid').flexOptions(
 {
  newp:1, 
  params:[{name: 'lastName', value: 'doe'}]
 }); 
}

The value of search textbox can be obtained by (instead of hardcoding to 'doe'):

$('.qsbox').val();

kevyau
  • 77
  • 1
  • 6
0

try like this

jQuery('#userflexiGrid').flexOptions({                            
                            url: 'FlexiGridService.asmx/GetDirectory',
                            qtype: 'lastName',
                            query: 'doe'                            
                        }).flexReload();
themhz
  • 8,335
  • 21
  • 84
  • 109
0

Instead of this:

$("#userflexiGrid").flexigrid({
    url: 'FlexiGridService.asmx/GetDirectory',
    params: [{ name: 'lastName', value: 'doe'}],
    dataType: 'xml',

do this:

$("#userflexiGrid").flexigrid({
    url: 'FlexiGridService.asmx/GetDirectory?lastName=doe',
    dataType: 'xml',

Actually, there is no such thing called params.

Please have a look at the documentation page here

Anwar
  • 4,470
  • 4
  • 24
  • 30