1

I am using the jquery-bootgrid to render a couple of grinds. It works brilliant. I want to send some additional parameters for the grid to my MVC controller. How can i pass those parameters ? I have tried :

$("#results-grid").bootgrid({
ajaxSettings: {
    url: testResultsListUrl,
    data: { testSubject: '2', another : '3' }
    }    
});

But it does not seem to work. If i put all the properties for the ajax object inside the ajaxSettings, the un set ulr error is thrown.

Can you please help ?

Mihai Tibrea
  • 641
  • 5
  • 23

1 Answers1

5

I managed to do it, i saw a discussion on git for this project. What I had to do to be able to send additional params to my controller was :

$("#results-grid").bootgrid({
ajax: true,
url: testResultsListUrl,

requestHandler: function (request) {
    if (testSubject != "") {
        request.testSubject = testSubject;
    }
    if (medicalDevice != "") {
        request.medicalDevice = medicalDevice;
    }

    return request;
}

The requestHandler is the object that is sent with all the parameters, for the grid. You can add all your parameters inside of it.

Mihai Tibrea
  • 641
  • 5
  • 23