Subgrids are for different entities, both of which are related to the parent entity. The form has one field and 2 subgrids. The PCF is renders checkboxes for available options and is configured on a subgrid for either a many-to-many-relationship or an entity with 2 lookups (the parent and the available options entity). When one PCF entity is on the form, there are no problems. With 2, things get interesting. First off the Power Apps Form designer is allowing me to add and configure the PCF. That is a nice feature. However, when I moved the 2nd subgrid to a new tab, suddenly there were 2 PCF instances shown on the 2nd tab configuration of the Subgrid. I raise this issue, because the first issue I ran into is that the init method is fired multiple times on each tab. I have set breakpoints and have console messages to observe, and the first tab, shows only the config settings on the 1st tab. The 2nd tab is showing config settings from both 1st and 2nd tab. I used the Classic UI to clean up the 2nd tab multi-instances. This was mainly to calm my own fears that this was causing the multi-firing issue.
I am using React and FluentUi for the TSX and passing the event handler from the "index.ts" to the TSX. So, when checkboxes are clicked, it invokes "toggleOption":
private toggleOption(id: string): void { ... if (checkedDatumIndex === -1) { data.push({ id: optionDatum.key, name: optionDatum.title }); console.log(`toggleOption - adding to data (current state isChecked: ${optionDatum.isChecked}), id: ${optionDatum.key}, name: '${optionDatum.title}'`); console.log(`toggleOption associate - parentSetName: ${this.parentSetName}, entityId: ${this.entityId}, relationshipName: ${this.relationshipName}, childSetName: ${this.childSetName}`); this.webApi?.associateRecord( this.parentSetName, this.entityId, this.relationshipName, this.childSetName, optionDatum.key); } ...
So, the fun and annoying part is that "this.relationshipName" on the 2nd Subgrid (2nd tab) is carrying the configuration info from the first Subgrid (1st tab). The multiple intit firings may have something to do with this. But I am at wit's end. Any help will bwe appreciated.