Skip to content

Insert an image according to the field value #207

@ticelso

Description

@ticelso

Hello people.
I have a field in my database called 'status_fun' that is being loaded normally inside the grid.
In the images directory I put two images in the [images / flags] directory named '1.png' and '2.png'.
I need to show these images according to the value of the 'status_fun' field which can be '1' or '2', for that I'm using the example:

DatabaseGrid.prototype.initializeGrid = function(grid) { var self = this; // render for the action column grid.setCellRenderer("action", new CellRenderer({ render: function(cell, id) { cell.innerHTML+= "<i onclick=\"datagrid.deleteRow("+id+");\" class='fa fa-trash-o red' ></i>"; } })); getColumn("status_fun").cellEditor.minWidth = 105; setCellRenderer("status_fun", new CellRenderer({ render: function (cell, value) { cell.innerHTML = value ? "<img src='" + image("flags/" + value.toLowerCase() + ".png") + "' alt='" + value + "'/>" : ""; cell.style.textAlign = "center"; } })); grid.renderGrid("tablecontent", "testgrid"); };

The error returned is that the column 'status_fun' does not exist.
How do I make the column available so I can make this change?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions