Hi.
I have my igGrid and the datasource is filtered by two dates entered into two igdatepicker, it works fine, but now the problem is I can not use the features of the grid, I show the code:
here i filtering by the datepicker:
function Calculo() { var fInicio = document.getElementById("FechaInicio").value; var fFin = document.getElementById("FechaFin").value; $.getJSON( "/ComisionesCalculadas/Calculo", { fechainicio: fInicio, fechafin: fFin }, function (json) { $("#grid").igGrid("dataSourceObject", json); $("#grid").igGrid("dataBind"); }, "json" ); }
function busqueda() { var fInicio = document.getElementById("FechaInicio").value; var fFin = document.getElementById("FechaFin").value; $.getJSON( "/ComisionesCalculadas/Busqueda", { fechainicio: fInicio, fechafin: fFin }, function (json) { $("#grid").igGrid("dataSourceObject", json); $("#grid").igGrid("dataBind"); }, "json" ); }
and there is my controllers:
[HttpGet] public JsonResult Busqueda(string fechainicio, string fechafin) { DateTime fechaInicio = Convert.ToDateTime(fechainicio); DateTime fechaFin = Convert.ToDateTime(fechafin); var busqueda = this.busquedaFiltrada(fechaInicio, fechaFin); return Json(busqueda, JsonRequestBehavior.AllowGet); } [HttpGet] public JsonResult Calculo(string fechainicio, string fechafin) { DateTime fechaInicio = Convert.ToDateTime(fechainicio); DateTime fechaFin = Convert.ToDateTime(fechafin); db.spComisionesCalcular(fechainicio, fechaFin); var calculo = this.busquedaFiltrada(fechaInicio, fechaFin); return Json(calculo, JsonRequestBehavior.AllowGet); }
public IQueryable busquedaFiltrada(DateTime fechainicio, DateTime fechafin) {
var fechas = from p in db.viewCalculo orderby p.FechaEvento where p.FechaEvento == fechainicio || p.FechaEvento > fechainicio && p.FechaEvento < fechafin || p.FechaEvento == fechafin select p; return fechas; }
If someone could help me I thank you in advance.
Regards
Christhian.
Hi,
are you getting any specific errors?
Thanks,
Angel
Hi Angel.
The problem is that the features do not work, sorting, filtering and paging, the grid is not refreshed when I use them, this is the code I use to activate these features:
.Features(features =>{ features.Sorting(); features.Paging().PageSize(10).FirstPageLabelText("").FirstPageTooltip("Ir a primera pagina").PrevPageLabelText("").PrevPageTooltip("Ir a pagina Anterior").ShowPagerRecordsLabel(true) .LastPageLabelText("").LastPageTooltip("Ir a Ultima pagina").NextPageLabelText("").NextPageTooltip("Ir a Siguiente pagina").PageSizeDropDownLabel("Mostrar").PageSizeDropDownTrailingLabel("Registros"); features.Filtering().FilterButtonLocation(Location.Left);});
There is an error that appears to me, just do nothing, change page and does not change, drawing data and does not move, I want to filter and not filter them.
Maybe you and able to see that the change in runtime datasource, but you tell me, I read some sorting and filtering remote, but if truth is not the case.
And I hope you can help me.
regards