joeharrison714 / MVCGrid.Net

http://mvcgrid.net
MIT License
75 stars 56 forks source link

Can you use your view model with mvcgrid.net #129

Open IntrinsicInnovation opened 7 years ago

IntrinsicInnovation commented 7 years ago

Every other data grid (grid.mvc for example) simply uses your view model like so:

from your controller: return View(timeSearchResults); Where timeSearchResults is just a list of objects.

But, mvcgrid.net has only hardcoded server side search code, which seems non standard. Why can't you just pass data into the view and have it appear in the grid?. There's no documentation on how to do that, and every single example has no dynamic data binding, from what I can see.

Mvcgridconfig.cs:

.WithRetrieveDataMethod((options) => { var result = new QueryResult(); using (var db = new SampleDatabaseEntities()) { result.Items = db.People.Where(p => p.Employee).ToList(); } return result; })

IntrinsicInnovation commented 7 years ago

It's kind of weird how this "grid" is setup. No wonder no one is using it anymore. If I submit a form, how can I get those parameters to pass into the grid query? I can see how I can set it client side, but that's not good at all, since I'm submitting the entire form, why do I need to set it client side as well? Bad design. Zero documentation. You should just be able to pass data into the view and it should display it, end of story. But, no it has a non standard grid config function. bad idea.

IntrinsicInnovation commented 7 years ago

OK, I found some sample code on the demos page:

MVCGrid.setAdditionalQueryOptions('AQOGrid', { param1: $('#parameter1Textbox').val(), param2: $('#parameter2Textbox').val(), param3: $('#parameter3Textbox').val() });

But, what if I post the entire form, then transfer to a new view? That seems a bit awkward. There should still be a way to just use a view model on the page where the grid is located. Anyone know where the documentation is on that?

IntrinsicInnovation commented 7 years ago

No response from support. From above, it seems the grid has to be on the same page as the setAdditionalQueryOptions statement? As, what if the grid is on a different view? You can't pass data dynamically to the grid?

IntrinsicInnovation commented 6 years ago

Dumped this pile of garbage. Stay away. I actually wrote my own grid using the built in one with asp.net mvc. Will be posting on github shortly.