Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed error details two column #223

Merged
merged 6 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion src/components/designSystemExtension/DetailsFields/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,32 @@ class DetailsFields extends LitElement {

getFieldsHtml(arFields): any {
const arFHtml: any[] = [];
const fields: any[] = [];
arFields?.forEach(field => {
const thePConn = field.getPConnect();
const theCompType = thePConn.getComponentName().toLowerCase();
if (theCompType === 'reference') {
const configObj = thePConn.getReferencedView();
configObj.config.readOnly = true;
configObj.config.displayMode = 'DISPLAY_ONLY';
const propToUse = { ...thePConn.getInheritedProps() };
configObj.config.label = propToUse?.label;
const loadedPConn = thePConn.getReferencedViewPConnect(true).getPConnect();
const data = {
type: theCompType,
pConn: loadedPConn
};
fields.push(data);
} else {
const data = {
type: theCompType,
config: thePConn.getConfigProps()
};
fields.push(data);
}
});

for (const field of arFields) {
for (const field of fields) {
if (field?.type === 'reference') {
arFHtml.push(html`
<div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/templates/MultiReferenceReadonly/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class MultiReferenceReadonly extends BridgeBase {
getMultiReferenceHtml(): any {
const configObj = this.pConn.getReferencedView();
configObj.config.label = this.label;
this.pConn = this.pConn.getReferencedViewPConnect(true).getPConnect();
// this.pConn = this.pConn.getReferencedViewPConnect(true).getPConnect();
return html`<simple-table-manual .pConn=${this.pConn}></simple-table-manual>`;
}

Expand Down
9 changes: 6 additions & 3 deletions src/components/templates/SimpleTable/SimpleTableManual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import '../PromotedFilters';
import { Utils } from '../../../helpers/utils';
import { buildFieldsForTable } from './helpers';
import { FieldGroupUtils } from '../../../helpers/field-group-utils';
import { getDataPage } from '../../../helpers/data_page';

// import the component's styles as HTML with <style>
import { simpleTableManualStyles } from './simple-table-manual-styles';
Expand Down Expand Up @@ -255,11 +256,13 @@ class SimpleTableManual extends BridgeBase {
const context = this.thePConn.getContextName();
// if dataPageName property value exists then make a datapage fetch call and get the list of data.
if (dataPageName) {
PCore.getDataApiUtils()
.getData(dataPageName, parameters, context)
getDataPage(dataPageName, parameters, context)
.then(response => {
const data = this.formatRowsData(response.data.data);
const data = this.formatRowsData(response);
this.rowData = data;
})
.catch(e => {
console.log(e);
});
} else {
// The referenceList prop has the JSON data for each row to be displayed
Expand Down
24 changes: 1 addition & 23 deletions src/components/templates/details/Details/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,29 +66,7 @@ class Details extends DetailsTemplateBase {
this.arFields = [];
const pKid = kid.getPConnect();
const fields = pKid.getChildren();
fields?.forEach(field => {
const thePConn = field.getPConnect();
const theCompType = thePConn.getComponentName().toLowerCase();
if (theCompType === 'reference') {
const configObj = thePConn.getReferencedView();
configObj.config.readOnly = true;
configObj.config.displayMode = 'DISPLAY_ONLY';
const propToUse = { ...thePConn.getInheritedProps() };
configObj.config.label = propToUse?.label;
const loadedPConn = thePConn.getReferencedViewPConnect(true).getPConnect();
const data = {
type: theCompType,
pConn: loadedPConn
};
this.arFields.push(data);
} else {
const data = {
type: theCompType,
config: thePConn.getConfigProps()
};
this.arFields.push(data);
}
});
this.arFields.push(...fields);
}

this.requestUpdate();
Expand Down
6 changes: 3 additions & 3 deletions src/components/templates/details/DetailsTwoColumn/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ class DetailsTwoColumn extends DetailsTemplateBase {

for (const kid of this.children) {
const pKid = kid.getPConnect();
const pKidData = pKid.resolveConfigProps(pKid.getRawMetadata());
const fields = pKid.getChildren();
if (this.children.indexOf(kid) == 0) {
this.arFields = pKidData.children;
this.arFields = fields;
} else {
this.arFields2 = pKidData.children;
this.arFields2 = fields;
}
}

Expand Down
Loading