kendo ui grid with no model

4 posts, 0 answers
  1. Jim
    Jim avatar
    35 posts
    Member since:
    May 2011

    Posted 19 Sep 2014 Link to this post

    Hi I want to create a grid using the server wrapper without having to specify a certain model, I just want a column to put string values and a custom column to delete the values.

    so with javascript I can do that this way:

    ​ $("#gridtest").kendoGrid({
    height: 150,
    columns: [
    {
    attributes: {"style":"padding-left:0px"},
    field: "date",
    title: "Selected Dates",
    },
    //{ command: [{ className:"select", name: "destroy", text: "" }], title: " ", width: 40 }
    { command: [{ id: "destroy", name: "destroy", template: "<img class='select' src='@Url.Content("~/Contents/Images/delete.png")' onclick='deleteGridRow(this)'/>" }], title: " ", width: 40 }
    ],
    editable: "inline"
    });


  2. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2289 posts

    Posted 23 Sep 2014 Link to this post

    Hello Jim,

    MVC wrapper always requires model. It could be explicitly set Grid<Some Model> /as in the remote binding example/ or inferred implicitly Grid(Model) /as in the local binding example/.

    You can also create dummy view model with `field: "date",` property so that the grid binds properly.

    Regards,
    Nikolay Rusev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Stefano
    Stefano avatar
    2 posts
    Member since:
    Mar 2015

    Posted 02 Jun 2016 in reply to Nikolay Rusev Link to this post

    I've same problem. I have not a predefinite model, my model is dynamic. For example suppose to create a grid where columns are variable from a sql query where columns select can change. How can I do that ?
  4. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2310 posts

    Posted 03 Jun 2016 Link to this post

    Hello Stefano,

    I would recommend to check the following example project, which demonstrates a possible approach to achieve the task.

    Regards,
    Dimiter Madjarov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top