Avatar

How to change color of time in the table

pk

I need to change color of time in the table.

Follow 3 followers
0

7 comments

Avatar
pk 0 votes
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);
}
 
0
Comment actions Permalink
Avatar
pk 0 votes

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.
0
Comment actions Permalink
Avatar
pk 0 votes

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

0
Comment actions Permalink
Avatar
Sean Tachibana 0 votes

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:
 
Please note that this is a DOM manipulation, so it might not work anytime after the update occurs.
 
Hopefully, this helps.
0
Comment actions Permalink
Avatar
pk 0 votes

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.

0
Comment actions Permalink
Avatar
William Sayama 0 votes

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 :)

0
Comment actions Permalink