Juan Carlos Medina
Juan Carlos Medina

Reputation: 3

Binding JSON to kendo grid JavaScript

Help me fix this code that was runing perfect two days ago. I don't have idea what i've chanched, but now, the grid is just empty, can you get me some help? Please.

$("#grid").kendoGrid({
       sortable: true,
       groupable: true,
       scrollable: true,
       height: "300px",
       pageable: {
         pageSizes: 9
                 },
       dataSource: {
         transport: {
             read: {
                url: "http://localhost/pharmacypoints/api/Productos/getSinFiltro",
                    dataType: "Json"
                              }
             }
                },
    Columns:  [
              { field: "Codigo",
                tittle: "Codigo"
              }, 
      { field: "Descripcion", 
        tittle: "Descripcion" 
      }, 
      { field: "Familia", 
        tittle: "Familia"
      }, 
      { field: "Laboratorio",
        title: "Laboratorio"
      }, 
      { field: "Clasificacion",
        tittle: "Clasificacion"
      }]

                        });

The database result is like this:

[{"Codigo":"6140","Producto":"CIPROXINA FA 200ML 400MG","Familia":"ANTIBIOTICO 10","Clasificacion":"CONTROLADOS","Laboratorio":"BAYER DE MEXICO, SA DE CV"}, and more objects

Upvotes: 0

Views: 6859

Answers (1)

OnaBai
OnaBai

Reputation: 40887

Two minor problems:

  1. Columns must be lower case.
  2. It is title and not tittle.

Try this:

$("#grid").kendoGrid({
    sortable  : true,
    groupable : true,
    scrollable: true,
    height    : "300px",
    pageable  : {
        pageSizes: 9
    },
    dataSource: {
        transport: {
            read: {
                url     : "http://localhost/pharmacypoints/api/Productos/getSinFiltro",
                dataType: "Json"
            }
        }
    },
    columns   : [
        { field: "Codigo", title: "Codigo" },
        { field: "Descripcion", title: "Descripcion" },
        { field: "Familia", title: "Familia" },
        { field: "Laboratorio", title: "Laboratorio" },
        { field: "Clasificacion", title: "Clasificacion" }
    ]
});

Upvotes: 2

Related Questions