Commit a7ffe555 by zhaochengxiang

解决可伸缩列与排序器冲突

parent 88c939b5
......@@ -13,7 +13,9 @@ import { AnchorId, AnchorTimestamp, Action, CatalogId, ModelerId } from '../../.
import './ModelTable.less';
const ResizeableHeaderCell = props => {
const { onResize, width, ...restProps } = props;
const { onResize, width, onClick, ...restProps } = props;
const [ resizing, setResizing ] = useState(false);
if (!width) {
return <th {...restProps} />;
......@@ -23,10 +25,23 @@ const ResizeableHeaderCell = props => {
<Resizable
width={width}
height={0}
onResize={onResize}
onResize={(event, {element, size, handle}) => {
setResizing(true);
onResize && onResize(event, { size });
}}
draggableOpts={{ enableUserSelectHack: false }}
>
<th {...restProps} />
<th
onClick={(...args) => {
//解决可伸缩列与排序器冲突
if (!resizing && onClick) {
onClick(...args);
}
setResizing(false);
}}
{...restProps}
/>
</Resizable>
);
};
......@@ -85,17 +100,17 @@ const ModelTable = (props) => {
sorter: true,
sortDirections: ['ascend', 'descend'],
onCell: (record, rowIndex) => {
if (!record.digest) {
dispatch({
type: 'datamodel.getDataModelDigest',
payload: {
id: record.id
},
callback: _data => {
record.digest = _data;
}
})
}
// if (!record.digest) {
// dispatch({
// type: 'datamodel.getDataModelDigest',
// payload: {
// id: record.id
// },
// callback: _data => {
// record.digest = _data;
// }
// })
// }
},
render: (text, record, index) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment