Question / Problem
I made a customization for record list view.
I put a button in the header space. When the user clicks the button, it sums up a number field (expense) of all the records in the current list and shows the total.
Here are the details:
- It works fine on Desktop browser.
- I uploaded the same file also to the "Upload JavaScript for Mobile" setting.
- But on the smartphone app, nothing appears and no any errors.
I don't understand why the same code works on PC but not on mobile. The app is the same, the field is the same. Can I not use the same customization for both?
Here is my code!
Code / Attempts
(() => {
'use strict';
kintone.events.on('app.record.index.show', (event) => {
const spaceElement = kintone.app.getHeaderMenuSpaceElement();
const button = document.createElement('button');
button.textContent = 'Calculate Total';
button.onclick = () => {
kintone.api('/k/v1/records', 'GET', {
app: kintone.app.getId(),
query: kintone.app.getQueryCondition()
}, (resp) => {
let total = 0;
resp.records.forEach((record) => {
total += Number(record.expense.value);
});
alert('Total: ' + total);
});
};
spaceElement.appendChild(button);
return event;
});
})();
Any help is appreciated. Thank you!