0

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

1 Answer 1

2

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" }
    ]
});
Sign up to request clarification or add additional context in comments.

8 Comments

Thanks! OnaBai, However i found out those mistakes, my real problem was in the php file, but thanks for your response anyway. I'm new in this site, i don't know if i can give you a star or stuf...
So, my grid is working fine now, but there's a little issue, let me explain myself, i'm building a site where a user cans search for stuff, so there are 3 opcions: by descripcion, by code, or show them all, so i change the grid's datasource by every opcion, that's running fine now but the grid needs always two clicks to show new results. Is there any property wich i could use to fix it?
Not sure I understand your question. Can you share some code in JSFiddle showing what you have and what is the problem?
Does the grid always have the same structure (same columns) and the question is the filtering, sorting, grouping condition?
you give a code and click the search button, the grid changes to show products with the given code tha's ok, then you give a diferent code or even the same code and click the search button, the grid now should call again the method but nothing happens, you click again the button and it finally works , but this loop begins again
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.