mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Store UI pagination fix
This commit is contained in:
parent
b74cc71e30
commit
933e0d16a4
@ -194,10 +194,9 @@ class SubscriptionDetails extends React.Component {
|
||||
`/admin/subscription/${this.props.uuid}?` + encodedExtraParams,
|
||||
).then(res => {
|
||||
if (res.status === 200) {
|
||||
console.log(res.data.data.data);
|
||||
this.setState({
|
||||
loading: false,
|
||||
data: res.data.data.data
|
||||
data: res.data.data
|
||||
});
|
||||
}
|
||||
|
||||
@ -216,6 +215,21 @@ class SubscriptionDetails extends React.Component {
|
||||
});
|
||||
};
|
||||
|
||||
handleTableChange = (pagination, filters, sorter) => {
|
||||
const pager = {...this.state.pagination};
|
||||
pager.current = pagination.current;
|
||||
this.setState({
|
||||
pagination: pager,
|
||||
});
|
||||
this.fetch({
|
||||
results: pagination.pageSize,
|
||||
page: pagination.current,
|
||||
sortField: sorter.field,
|
||||
sortOrder: sorter.order,
|
||||
...filters,
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
const {data, pagination, loading, selectedRows} = this.state;
|
||||
return (
|
||||
@ -240,14 +254,16 @@ class SubscriptionDetails extends React.Component {
|
||||
<Table
|
||||
columns={columns}
|
||||
rowKey={record => (record.device.deviceIdentifier + record.device.enrolmentInfo.owner + record.device.enrolmentInfo.ownership)}
|
||||
dataSource={data}
|
||||
dataSource={data.data}
|
||||
pagination={{
|
||||
...pagination,
|
||||
size: "small",
|
||||
// position: "top",
|
||||
total: data.recordsTotal,
|
||||
showTotal: (total, range) => `showing ${range[0]}-${range[1]} of ${total} devices`
|
||||
// showQuickJumper: true
|
||||
}}
|
||||
onChange={this.handleTableChange}
|
||||
loading={loading}
|
||||
scroll={{x: 1000}}
|
||||
/>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user