I want to add a column field inside backgrid to display img and other information related to that user.
var columns = [
{ name: "id", label: "Id", cell: "integer",editable: false },
{ name: "active_image", label: "Image", cell: "uri",editable: false },
{ name: "worker_id", label: "Worker", cell: "string",editable: false },
{ name: "city", label: "City", cell: "string",editable: false }
];
I would recommend you to create new image cell type. However, the simplest solution is to extend the basic Backgrid.Cell
:
{
name: 'active_image',
label: 'Image',
editable: false,
cell: Backgrid.Cell.extend({
render: function() {
var src = this.model.get(this.column.get('name'));
this.$el.html($('<img>').attr('src', src));
return this;
}
})
}
The render function here is rather simplified (and not tested), just to give the idea of howto.