I am looking for help with my PCF control. I have some experience with field PCF controls but am new to dataset templates. In a main view for Dynamics 365 Model Driven App, I need to create a PCF control to display text in a whole number column. I need to keep all the same functionality that comes with the view (sorting, filtering, etc). I do not want to recreate the table as then we lose a lot of functionality, even when recreating paging, selected records, etc. using React. I should just be able to parse through the records, then for each column, find the column that I want to display the text and change the text. In my updateView method, I am doing all of this and creating the new label. I am then calling a function to change the number to text, however that is not working. I have the recordId, Columnname and the new value to be displayed. However, I cannot find a way to update that cell. Debugging this method, it always is coming up null. I have tried:
1.
const row = document.querySelector(`tr[data-id='${recordId}']`);
if (row) {
const tcell = row.querySelector(`td[data-column='${columnName}']`);
}
2.
if (this.cellRefs[recordId] && this.cellRefs[recordId][columnName]) {
this.cellRefs[recordId][columnName].textContent = newValue;
}
3.
const cell = document.getElementById(`[data-row-id='${recordId}'][data-column-name='${columnName}']`);
if (cell) {
cell.textContent = newValue; // Display custom text
}
Can someone help me and let me know if there is a way to do this without recreating the entire thing?