Merge branch 'master' into 'master'

Store UI pagination fix

Closes product-iots#282

See merge request entgra/carbon-device-mgt!396
feature/appm-store/pbac
Dharmakeerthi Lasantha 5 years ago
commit 7effaa844b

@ -194,10 +194,9 @@ class SubscriptionDetails extends React.Component {
`/admin/subscription/${this.props.uuid}?` + encodedExtraParams, `/admin/subscription/${this.props.uuid}?` + encodedExtraParams,
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
console.log(res.data.data.data);
this.setState({ this.setState({
loading: false, 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() { render() {
const {data, pagination, loading, selectedRows} = this.state; const {data, pagination, loading, selectedRows} = this.state;
return ( return (
@ -240,14 +254,16 @@ class SubscriptionDetails extends React.Component {
<Table <Table
columns={columns} columns={columns}
rowKey={record => (record.device.deviceIdentifier + record.device.enrolmentInfo.owner + record.device.enrolmentInfo.ownership)} rowKey={record => (record.device.deviceIdentifier + record.device.enrolmentInfo.owner + record.device.enrolmentInfo.ownership)}
dataSource={data} dataSource={data.data}
pagination={{ pagination={{
...pagination, ...pagination,
size: "small", size: "small",
// position: "top", // position: "top",
total: data.recordsTotal,
showTotal: (total, range) => `showing ${range[0]}-${range[1]} of ${total} devices` showTotal: (total, range) => `showing ${range[0]}-${range[1]} of ${total} devices`
// showQuickJumper: true // showQuickJumper: true
}} }}
onChange={this.handleTableChange}
loading={loading} loading={loading}
scroll={{x: 1000}} scroll={{x: 1000}}
/> />

Loading…
Cancel
Save