Skip to content

Commit 0e1ebf9

Browse files
committed
fixed the bug with order of analysis properties
1 parent 64a8be5 commit 0e1ebf9

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

components/dataset/viewer/BasicResourceList.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,16 @@ class BasicResourceList extends React.Component {
169169
There was no resource in the selected dataset! This might be due to the connection problems or because the estimated query execution time exceeds the configured limit. Please check the connection parameters of your dataset&apos;s Sparql endpoint or add resources to your dataset...</div>
170170
</div>;
171171
} else {
172+
let sortedProps = [];
172173
if(this.checkAnalysisProps()){
174+
//first sort the analysis property
173175
for(let prop in this.props.resources[0].propsForAnalysis){
174-
dtableHeaders.push(<Table.HeaderCell key={prop}>{prop}</Table.HeaderCell>);
176+
sortedProps.push(prop);
177+
sortedProps.sort();
175178
}
179+
dtableHeaders = sortedProps.map((item)=> {
180+
return (<Table.HeaderCell key={item}>{item}</Table.HeaderCell>);
181+
});
176182
theaderDIV =
177183
<Table.Header>
178184
<Table.Row>
@@ -214,9 +220,10 @@ class BasicResourceList extends React.Component {
214220
}
215221
dtableCells = [];
216222
if(self.checkAnalysisProps()){
217-
for(let prop in node.propsForAnalysis){
218-
dtableCells.push(<Table.Cell key={'c'+prop} title={node.propsForAnalysis[prop]}>{Object.keys(analysisPropsConfgis).length && analysisPropsConfgis[prop] ? <ObjectIViewer datasetURI={this.props.datasetURI} property={prop} spec={{value: node.propsForAnalysis[prop]}} config={analysisPropsConfgis[prop]}/> : URIUtil.getURILabel(node.propsForAnalysis[prop])}</Table.Cell>);
219-
}
223+
//get the values in order
224+
dtableCells = sortedProps.map((prop)=> {
225+
return (<Table.Cell key={'c'+prop} title={node.propsForAnalysis[prop]}>{Object.keys(analysisPropsConfgis).length && analysisPropsConfgis[prop] ? <ObjectIViewer datasetURI={this.props.datasetURI} property={prop} spec={{value: node.propsForAnalysis[prop]}} config={analysisPropsConfgis[prop]}/> : URIUtil.getURILabel(node.propsForAnalysis[prop])}</Table.Cell>);
226+
});
220227
resourceDIV =
221228
<Table.Row key={index}>
222229
<Table.Cell>{self.buildLink(0, encodeURIComponent(node.v), encodeURIComponent(node.d), title, image, dbClass, cloneable)}</Table.Cell>

0 commit comments

Comments
 (0)