Skip to content

Commit

Permalink
DataReference not using specified params issue fixed (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
tumms2021389 committed Oct 3, 2023
1 parent 489ba40 commit 70a68f6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export class SimpleTableManualComponent implements OnInit {
rowID: any;
response: any;
compositeKeys: any;
parameters: any;

constructor(
private angularPConnect: AngularPConnectService,
Expand Down Expand Up @@ -197,10 +198,12 @@ export class SimpleTableManualComponent implements OnInit {
presets,
allowTableEdit,
labelProp,
propertyLabel
propertyLabel,
fieldMetadata
} = this.configProps$;

this.label = labelProp || propertyLabel;
this.parameters = fieldMetadata?.datasource?.parameters;

const hideAddRow = allowTableEdit === false ? true : false;
const hideDeleteRow = allowTableEdit === false ? true : false;
Expand Down Expand Up @@ -872,7 +875,7 @@ export class SimpleTableManualComponent implements OnInit {
const context = this.pConn$.getContextName();
// if dataPageName property value exists then make a datapage fetch call and get the list of data.
if (dataPageName) {
this.dataPageService.getDataPageData(dataPageName, context).then((listData) => {
this.dataPageService.getDataPageData(dataPageName, this.parameters, context).then((listData) => {
const data = this.formatRowsData(listData);
this.originalData = data;
this.rowData = new MatTableDataSource(data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import { endpoints } from './endpoints';
import { ServerConfigService } from './server-config.service';
import { Utils } from '../_helpers/utils';

declare const window: any;

@Injectable({
providedIn: 'root',
providedIn: 'root'
})
export class DatapageService {
constructor(private http: HttpClient, private scService: ServerConfigService) {}
Expand All @@ -32,10 +30,16 @@ export class DatapageService {
return response.pxResults;
}

getDataPageData(dataPageName, context) {
getDataPageData(dataPageName, parameters, context) {
let dataViewParams;
if (parameters) {
dataViewParams = {
dataViewParameters: parameters
};
}
return new Promise((resolve, reject) => {
window.PCore.getDataApiUtils()
.getData(dataPageName, null, context)
.getData(dataPageName, dataViewParams, context)
.then((response) => {
resolve(response.data.data);
})
Expand Down

0 comments on commit 70a68f6

Please sign in to comment.