Create a blank first column in kendo ui grid -


i new kendo ui grid development.

i have requirement want display data in kendo ui grid.

i able bind data kendo grid using java-script.

this how did it.

(document.getelementbyid(divid)).kendogrid({             columns: cols,             datasource: data,                        change: onchange,             selectable: "multiple",             //selectable: "multiple cell",             schema: {                 model: {                     id: "id"                 }             }         }).data("kendogrid"); 

the data displayed in grid.

now, want create blank first column in grid display image. how can this. grid bound data dynamically. have not specified hard coded columns. columns created dynamically.

please can tell me on this.

you have explicitly define columns because:

  1. you want add columns not in model.
  2. the content of column image not kendoui basic type can inferred model definition.

said so, have add column like:

var cols = [     // other columns     ...     {         title :"image",         template: "<img src='my_image.gif'/>"     },     // more columns     ... ]; 

in addition might need use image not constant depending on content of column. might do:

var cols = [     // other columns     ...     {         title: "status",         template: "# if (status) { # <img src='ok.gif'/> # } else { # <img src='nak.gif'/> # } #"     },     {         title   : "photo",         template: "<img src='#= image #'/>"     }     // more columns     ... ]; 

where depending on value of field in model called status display image ok.gif or nak.gif. or directly use content of field image generating url image being displayed.

check here overview on kendoui templates.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -