我从mongodb获取记录并在reactjs中显示它。我想按日期字段的排序顺序呈现这些记录。请建议我。reactjs - 根据日期字段排序显示记录mongodb
我不使用芒果。只有Reactjs和mongodb。
class SearchResultsList extends React.Component {
constructor(props) {
super(props);
this.state = { };
}
render() {
return (<tbody>{ this.props.items.map((item) => <SearchResults key={ item.id
} item={ item } open={ this.props.open } />) }</tbody>);
}
}
class SearchResults extends React.Component {
constructor(props) {
super(props);
this.state = { };
}
render() {
return (
<tr onClick={ this.handleOpen } style={{color: 'blue',fontsize: '12',cursor:
'pointer'}}>
<td>{ this.props.item.OrderNumber }</td>
<td>{ this.props.item.Assignee }</td>
<td>{ this.props.item.Status }</td>
<td>{ this.props.item.OrderDate }</td>
<td>{ this.props.item.CreatedDate }</td>
</tr>
);
}
请提供更多的信息。你的后端表达了吗?你在用mongooose吗?也许张贴负责渲染数据的组件的片段。 –
请找到我上传的代码。我正在用mongodb使用reactjs。 – Karthikeyan