This is a migrated thread and some comments may be shown as answers.

Grid hierarchy Not load data detail

3 Answers 105 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Leonardino
Top achievements
Rank 1
Leonardino asked on 17 Jan 2014, 04:31 AM
I'm trying to use a simple master detail grid hierarchy 
but does not load the json service detail information 

this is my code, which is my error? 
Please help

<script>
$(document).ready(function() {
         $("#gridEventosEventos").kendoGrid({
            editable:true,
            height: 474,
           columns: [
               { field: "idEvento", title:"id evento", width: "150px"},
               { field: "nomCliente", title:"Nombre Cliente", width: "150px"},
               { field: "idCliente", title:"Telefono Cliente",  width: "120px" },
               { field: "nomEvento", title: "Celular Cliente", width: "120px" },
               { field: "idProyecto", title: "Email CLiente", width: "120px" },                        
               { field: "nomProyecto", title:"Codigo Ejecutivo Cuenta", width: "150px"},
               { field: "idUnidadDeNegocio", title:"Nombre Ejecutivo Cuenta", width: "150px" },
               { field: "nomUnidadDeNegocio", title:"Codigo Director Cuenta", width: "150px" },
               { field: "idCreadoPor", title:"Nombre Director Cuenta", width: "150px"},
               { field: "nomCreador", title:"Estado Cliente",  width: "120px"},
               { field: "categoria", title: "Nombre estado", width: "120px"},
               { field: "nomCategoria", title:"Nombre Director Cuenta", width: "150px"},
               { field: "estadoEvento", title:"Estado Cliente",  width: "120px"},
               { field: "nomEstadoEvento", title: "Nombre estado", width: "120px"}
           ],
           dataSource: {
            transport: {
                        read: { url :"/SiradSeguridadWS/sirad/api/SiradServletsEventos?consultarEventos",
                        dataType: "json"
                        },
                        parameterMap: function(options, operation) {
                            if (operation !== "read" && options.models) {
                                return {models: kendo.stringify(options.models)};
                            }
                        }
                    },
                    pageSize: 6,
                    serverPaging: true,
                    serverSorting: true,
                    schema: {
                        model: {
                            id: "idEvento",
                            fields: {
                            idEvento: {editable: true, nullable: true},
                            nomCliente: {editable: true, nullable: true },
                            idCliente: {editable: true, nullable: true },
                            nomEvento: {editable: true, nullable: true },
                            idProyecto: { editable: true, nullable: true },            
                            nomProyecto: { editable: true, nullable: true},
                            idUnidadDeNegocio: {editable: true, nullable: true },
                            nomUnidadDeNegocio: {editable: true, nullable: true },
                            idCreadoPor: {editable: true, nullable: true },            
                            nomCreador: { editable: true, nullable: true },
                            categoria: { editable: true, nullable: true},
                            nomCategoria: {editable: true, nullable: true },
                            estadoEvento: {editable: true, nullable: true },
                            nomEstadoEvento: {editable: true, nullable: true }
                            }
                        }
                  }
           },
           detailInit: detailIniteventos,
                dataBound: function() {
                    this.expandRow(this.tbody.find("tr.k-master-row").first());
                }
          });        
    });
    
    function detailIniteventos(e) {
                 $("<div/>").appendTo(e.detailCell).kendoGrid({
                 dataSource: {
                     transport: {
                         read: "/SiradSeguridadWS/sirad/api/SiradServletsEventos?consultarVersionEventos",
                         dataType: "json"  
                     },
                     parameterMap: function(options, operation) {
                         if (operation !== "read" && options.models) {
                             return {models: kendo.stringify(options.models)};
                         }
                     },
                     serverPaging: true,
                     serverSorting: true,
                     serverFiltering: true,
                     pageSize: 5,
                     schema: {
                     model: {
                         id: "idVersionEvento",
                         fields: {
                          idEvento: {editable: true, nullable: true},
                          idVersionEvento: {editable: true, nullable: true },
                          nomVersionEvento: {editable: true, nullable: true },
                          idCreadoPor: {editable: true, nullable: true },
                          nomCreadoPor: { editable: true, nullable: true },            
                          idDirigidoA: { editable: true, nullable: true},
                          nomDirigidoA: {editable: true, nullable: true },
                          comentario: {editable: true, nullable: true },
                          requiereSeguimiento: {editable: true, nullable: true },            
                          fechaDeSeguimiento: { editable: true, nullable: true }
                         }
                     },
                },
                     filter: { field: "idCliente", operator: "eq", value: e.data.idCliente }
                 },
                 scrollable: false,
                 sortable: true,
                 pageable: true,
                 columns: [
                     { field: "idVersionEvento", width: "70px" },
                     { field: "nomVersionEvento", title:"Ship Country", width: "110px" },
                     { field: "nomCreadoPor", title:"Ship Address" },
                     { field: "nomDirigidoA", title: "Ship Name", width: "200px" }
                 ]
    });
         }
    
     </script>

3 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 17 Jan 2014, 01:26 PM
Hi Leonardino,

Your code seems to be following the Hierarchy demo completely. What is the exact error message that you receive? Can you provide us with a runnable sample that we can take a look at?

Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Leonardino
Top achievements
Rank 1
answered on 17 Jan 2014, 02:21 PM
I think the problem is in the back End
in request.getQueryString (). trim () is coming

consultarVersionEventos&take=5&skip=0&page=1&pageSize=5&filter%5Blogic%5D=and&filter%5Bfilters%5D%5B0%5D%5Bfield%5D=idEvento&filter%5Bfilters%5D%5B0%5D%5Boperator%5D=eq&filter%5Bfilters%5D%5B0%5D%5Bvalue%5D=1

Why ? ... You should only get consultarVersionEventos

If forced to enter the corresponding method gets all the detail on each record

This is my servlet :

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("application/json");
_repository  = new MaestroEventos();
        try{
       String type = request.getQueryString().trim();
       if ("consultarEventos".equals(type)){
        EventosResponse respuesta = _repository.consultarEventos();
        if (respuesta.getCodResponse() == 0){
        List<EventosClientesDTO> listaDeEventos = respuesta.getListResponse();
        response.getWriter().print(_gson.toJson(listaDeEventos));  
        }else{
        response.getWriter().print(_gson.toJson(respuesta));      
        }          
       }else if ("consultarVersionEventos".equals(type)){
        EventosVersionResponse respuesta = _repository.consultarEventosVersiones();
        if (respuesta.getCodResponse() == 0){
        List<EventosClientesVersionDTO> listaDeVersionesEventos = respuesta.getListResponse();
        response.getWriter().print(_gson.toJson(listaDeVersionesEventos));  
        }else{
        response.getWriter().print(_gson.toJson(respuesta));      
        }          
       }else{
        EventosVersionResponse respuesta = _repository.consultarEventosVersiones();
        if (respuesta.getCodResponse() == 0){
        List<EventosClientesVersionDTO> listaDeVersionesEventos = respuesta.getListResponse();
        response.getWriter().print(_gson.toJson(listaDeVersionesEventos));  
        }else{
        response.getWriter().print(_gson.toJson(respuesta));      
        }   
        /*EventosVersionResponse respuesta = new EventosVersionResponse();
        respuesta.setCodResponse(-1);
        respuesta.setDescResponse("Especifica el nombre correcto del metodo que deseas ejecutar");
        response.getWriter().print(_gson.toJson(respuesta)); */
       }
        } catch(Exception ex){
        EventosResponse respuesta = new EventosResponse();
        respuesta.setDescResponse("Problemas en el servlet SiradServletsEventos, Clase error: "+ex.getClass().getName()+" Mensaje: " + ex.getMessage()+",Causa: "+ex.getCause());
        response.getWriter().print(_gson.toJson(respuesta)); 
        }
}

0
Kiril Nikolov
Telerik team
answered on 21 Jan 2014, 08:13 AM
Hello Leonardino,

The parameters that you see in the query string are the dataSource request, sending information about the data that it needs to request along with filters and pageSize, so you can get the correct data from the dataBase in your server side and return it back to the dataSource.

Please send a sample response from the server, so we can test your Grid's configuration.

Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Leonardino
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Leonardino
Top achievements
Rank 1
Share this question
or