Closed johnpreed closed 9 years ago
The additional option i need is passed as a query string parameter. so i tried setting the additional query options on document ready.
$(function () {
initAdditionalOptions();
});
function initAdditionalOptions() {
MVCGrid.setAdditionalQueryOptions("ReportsGrid", { projectId: $('#ProjectId').val() });
}
That technically works, but the id is in the url twice now: /Reports/Index/21?projectid=21
i can live with this, but is there a better approach here?
John, I believe I have a solution for you, but can you do me a huge favor and post to stackoverflow and then I will create the tag? This will help me out so others can ask questions on there. Just post the link to the question after. Thanks, Joe
Thank you, I've responded on there
Stack Overflow won't let me post my question because the tag "mvcgrid.net" is not an existing tag and I don't have 1500 reputation yet to create it. Sorry if this is the wrong forum for this. If you can create the tag i'll happily post this to SO.
I'll post my issue below:
I'm using MVCGrid.net (http://mvcgrid.net). First of all, fantastic grid tool! I have my grid working properly, however when i'm populating my grid I need to pass an additional parameter to my RetrieveDataMethod. The value i need to pass is part of my view model and I'm pretty sure I need to pass it as an AdditionalQueryOption. I don't want this to be a filter because i don't want it only sent after a client side event. I want it passed to my RetrieveDataMethod always. i tried adding data-mvcgrid-type='additionalQueryOption' to my hidden input, and it still wasn't sent. Then i noticed that this requires data-mvcgrid-apply-additional='event' to trigger the event. how is this different than a filter? Is there a grid loading event that i can hook into to register my hidden value as an additional query option? What's the right approach for my situation here?
Here's my Retrieve Data Method definition for my grid:
// this is the bit i need var projectId = ???; options.AdditionalQueryOptions.Add("projectId", projectId);
This is the View Code: