Wondering of anyone else has come across this problem.
(NOTE Support ticket has been lodged unless someone points out a blooper I am making).
FILES
PERSONNEL
UNIT HISTORY
UNITS
RELATIONSHIP
One Personnel File item related to many Unit History file items
Unit History has an auto numbering field called EVENT, and a connected field to UNITS to establish the unit name (also has from/to dates in years from drop down list)
Yes its correctly showing the Event Number items in the reverse order.
So somewhere the connected field is no longer obeying the sort order of the connected file and even if they are in the correct sequence, once you display another field than the sorting field it stops applying the sort sequence !!!
Yes, I’ve encountered the same situation. It’s because each connected field will use its own sort order within a given record row. This causes confusion when reading a row because each sub-data (the connected fields) across the columns are staggered vertically, intead of on the same line. So you can’t tell what belongs to what.
I’ve added some custom code to pin down all columns in my tables so they follow the sort order of a reference column, in this case: Lots, field_2270.
I know this may not be too helpful, but maybe it can give you an idea of the principle.
So here’s the code:
//Needed to get around the new limitation in knack where we can't control the connected field's order in a row.
//We have to rebuild the text appropriately.
function fixInspectionOrder(view, data) {
let needUpdate = false;
let lotsHtml = '';
let wipHtml = '';
let trialHtml = '';
let skuHtml = '';
let custHtml = '';
let lots = data[0].field_2270;
lots = JSON.parse(lots);
lots.forEach(lotRecId => {
const lotNbElement = document.querySelector('#' + view.key + ' tbody td.field_1457 [class="' + lotRecId + '"]');
if (lotNbElement) {
const lotNb = lotNbElement.textContent;
const yards = document.querySelector('#' + view.key + ' tbody td.field_361 [id="' + lotRecId + '"]').textContent;
const trial = document.querySelector('#' + view.key + ' tbody td.field_2608 [id="' + lotRecId + '"]').textContent;
const sku = document.querySelector('#' + view.key + ' tbody td.field_207 [id="' + lotRecId + '"]').textContent.substring(13);
const customerName = document.querySelector('#' + view.key + ' tbody td.field_182 [id="' + lotRecId + '"]').textContent;
lotsHtml += (lotsHtml ? '\n' + lotNb : lotNb);
wipHtml += (wipHtml ? '\n' + yards : yards);
trialHtml += (trialHtml ? '\n' + trial : trial);
skuHtml += (skuHtml ? '\n' + sku : sku);
custHtml += (custHtml ? '\n' + customerName : customerName);
needUpdate = true;
}
})
if (needUpdate) {
document.querySelector('#' + view.key + ' tbody tr td.field_1457').innerText = lotsHtml;
document.querySelector('#' + view.key + ' tbody tr td.field_361').innerText = wipHtml;
document.querySelector('#' + view.key + ' tbody tr td.field_2608').innerText = trialHtml;
document.querySelector('#' + view.key + ' tbody tr td.field_207').innerText = skuHtml;
document.querySelector('#' + view.key + ' tbody tr td.field_182').innerText = custHtml;
}
}
This is the grid, before the sorting (KTL disabled)
You can now follow horizontally the matching information on each sub-row.
Of course, all is driven by that rightmost colum: Lots Order.
This is created by a manual drag n drop operation elsewhere because we need a specific sequence. But you can just use the default sort order of a colum of your choince instead.
The general idea is to re-create the HTML content of each main row.
It’s not as big a problem as I first thought and can easily be worked around.
The fool this end forgot that you can sort the order of display for grids etc during build of the app so that they are sorted into the order I want them to appear.
One other point I might raise though, it appears that a paragraph field within a file is truncated within the builder file/record editing screen as shown below.
The complete text is there but the initial display is truncated