Closed jbengoa closed 9 years ago
When you declare the grid like this:
@(Html.Grid("nameOfYourGrid")....
The following code triggers the reload:
$('#nameOfYourGrid').trigger( 'reloadGrid' );
You should be able to bind the change event to this code.
I'm doing this:
$(function () {
$('#IdFormulario').change(function () {
Search($('#IdFormulario option:selected').val());
});
});
Search = function (id) {
$.getJSON('@Url.Action("Search", "encuestas")', { _idFormulario: id }, function (data) {
$("#gEncuesta").setGridParam({ 'data': data }).trigger("reloadGrid");
});
}
But... it doesn't refresh correctly the grid.
In the Chrome console I got this JSON:
{"total":1,"page":1,"records":1,"rows":[{"IdEncuesta":1,"NumSol":"2585","CodEvaluador":"2007022","CodEvaluado":"2007024","Fecha":"01-08-2014","Observaciones":"N/D","Puntuacion":31}]}
How can I rebind (refresh) the grid by change method from a DropDownList?
I don't see a reloadGrid div for accesing it via jQuery or something like that, like the implementation in jqgrid original. Now I need to refresh the grid while changing a DropDownList with his ID to pass it to the controller.
Somebody?