Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
765
don't work features: Sorting, Filtering and Paging
posted

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.

Parents Reply Children