Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert an image according to the field value #207

Open
ticelso opened this issue Aug 19, 2021 · 0 comments
Open

Insert an image according to the field value #207

ticelso opened this issue Aug 19, 2021 · 0 comments

Comments

@ticelso
Copy link

ticelso commented Aug 19, 2021

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?

@ticelso ticelso changed the title Inserir uma imagem conforme o valor do campo Insert an image according to the field value Aug 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant