HOW TO HIGHLIGHT A RESULT ACCORDING TO CONDITIONAL?
HOW TO HIGHLIGHT A RESULT ACCORDING TO CONDITIONAL?
Bebe Óleo
Posts: 4Questions: 1Answers: 0
How could I score a result without datatable? If a search would return a specific result in a row in the table, could this be in a different color or with the data in bold? In other words, highlight when specific data in one or more columns****
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Not sure I understand your question. Sounds like you want to highlight a cell or row based on row data. You can use
columns.createCell
orcreatedRow
for this. If this doesn't help maybe you can build a simple example of what you have with details of what you want to do.https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
EXAMPLE: I would like the conditional 'Ana Diva' and the date '09/12/2020' to be marked when a search was made.
I'm not following, sorry. All those records in your table match that condition - as the filter has been applied. What makes the highlighted rows special?
Colin
One option might be to use
rowCallback
. In the function get the value of the search input and if it matches the data then highlight the row. See this example. The example usescreatedRow
but you will want to userowCallback
since rowCallback runs each time the table is drawn.You will need to create your own search input if you don't actually want to filter the table rows.
Kevin
Pensei em criar uma tabela no banco de dados com os registros que ficariam em vermelho, por exemplo
data medico
2020-12-09 Ana Diva
xxxx-xx-xx x
as linhas que tivesse essa condição ficariam marcadas.
Gotcha, Kevin's post is the way to go then,
Colin
Thanks Colin, thanks, Kevin
I m try this tomorowwww