mirror of
https://github.com/getrebuild/rebuild.git
synced 2024-11-11 01:14:42 +08:00
fix: column resizing event
This commit is contained in:
parent
43549673ec
commit
da8d9eb982
1 changed files with 6 additions and 1 deletions
|
@ -68,7 +68,7 @@ class RbList extends React.Component {
|
|||
const styles = { width: cWidth + 'px' }
|
||||
const clazz = `unselect ${item.unsort ? '' : 'sortable'} ${idx === 0 && supportFixedColumns ? 'column-fixed column-fixed-2nd' : ''}`
|
||||
return <th key={'column-' + item.field} style={styles} className={clazz} data-field={item.field}
|
||||
onClick={item.unsort ? null : this._sortField.bind(this, item.field)}>
|
||||
onClick={(e) => !item.unsort && this._sortField(item.field, e)}>
|
||||
<div style={styles}>
|
||||
<span style={{ width: (cWidth - 8) + 'px' }}>{item.label}</span>
|
||||
<i className={'zmdi ' + (item.sort || '')} />
|
||||
|
@ -147,6 +147,9 @@ class RbList extends React.Component {
|
|||
containment: '.rb-datatable-body',
|
||||
axis: 'x',
|
||||
helper: 'clone',
|
||||
start: function () {
|
||||
that.__columnResizing = true
|
||||
},
|
||||
stop: function (event, ui) {
|
||||
const field = $(event.target).parents('th').data('field')
|
||||
let left = ui.position.left - 0
|
||||
|
@ -161,6 +164,7 @@ class RbList extends React.Component {
|
|||
}
|
||||
}
|
||||
that.setState({ fields: fields }, () => $scroller.perfectScrollbar('update'))
|
||||
setTimeout(() => that.__columnResizing = false, 100)
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -298,6 +302,7 @@ class RbList extends React.Component {
|
|||
|
||||
// 排序
|
||||
_sortField(field, e) {
|
||||
if (this.__columnResizing) return // fix: firefox
|
||||
const fields = this.state.fields
|
||||
for (let i = 0; i < fields.length; i++) {
|
||||
if (fields[i].field === field) {
|
||||
|
|
Loading…
Reference in a new issue