How to change color of time in the table

I need to change color of time in the table.

Please reference the following article: Change field text colors

But use the Get Record Field Element API (used on the Record Detail page) instead of the Get Record List Field Elements API (used on the Record List page). Also run the code within the handler of the Record Details event.

If you still run into any issues, please share the code that you are using in this thread.

When i try with table field it’s not return the value of field.

 

kintone.events.on([‘app.record.detail.show’], function (event){

let record = event.record;

let resTable = kintone.app.record.getFieldElement(‘Time’)

console.log(‘resTable’, resTable);

}

 

Notes

  • The retrieval of data and the DOM’s style is supported
  • Changing the internal structure of the DOM may lead to features not functioning correctly after a Kintone update.
  • The following fields cannot be retrieved, and null will be returned
    • Status
    • Assignee
    • Fields within tables <<<<<<
    • Fields within the Related records
    • Field group
  • Null will be returned if you specify a field you have no access to.

Back to my question “How to change color of time in the tables”?

Hello pk,

As you know, you can’t get the fields in the table with getFieldElement.

If you want to change the color of a field in the table, the only way is to get it with a DOM manipulation.

If you want to use getFieldElement to get and handle the elements of the table itself, I think it’s the following:

var $trs = $(kintone.app.record.getFieldElement("Table")).find("tbody > tr");

 

Even if you use getFieldElement, you will still need to manipulate the DOM, so I think it would be best to use

something like settimeout until a page is completely displayed and then retrieves the element.

 

JavaScript setTimeout:

https://www.javascripttutorial.net/javascript-bom/javascript-settimeout/

 

Please note that this is a DOM manipulation, so it might not work anytime after the update occurs.

 

Hopefully, this helps.

Thank you Sean san.

May i request to add this feature in the next update. 

like

  1. change color of a field in the table.

  2. change background color of a field in the table.

Hi pk

I’ve shared your request with the Kintone dev team for being able to get table field elements, so that codes for coloring tables would become more stable :slight_smile: