nhn / tui.grid

🍞🔡 The Powerful Component to Display and Edit Data. Experience the Ultimate Data Transformer!
http://ui.toast.com/tui-grid/
MIT License
2.42k stars 394 forks source link

can‘t be dragged row after pagination #1869

Open Drwna opened 1 year ago

Drwna commented 1 year ago

Describe the bug can’t be dragged row after pagination, can only be dragged on the first page, other pages can't be dragged

Version latest

Example https://codesandbox.io/s/stoic-maxwell-o47co5?file=/src/index.js

IDKNWHORU commented 1 year ago

@jajugoguma when executing the createDraggable RowInfo function, it seems that the index calcuation of paginted rows is not taken into account. I'm curious about your thoughts on prevent dragging or index calculations when applying pagination.

export function createDraggableRowInfo(store: Store, posInfo: PosInfo): DraggableRowInfo | null {
  const { data, dimension } = store;
  const { rawData, filters } = data;

  // if there is any filter condition, cannot drag the row
  if (!rawData.length || filters?.length) {
    return null;
  }

  const { offsetLeft, offsetTop, index } = getMovedPosAndIndexOfRow(store, posInfo);
  const { rowKey, _attributes } = rawData[index];
  const row = createFloatingDraggableRow(store, rowKey, offsetLeft, offsetTop, posInfo);

  return _attributes.disabled
    ? null
    : {
        row,
        rowKey,
        line: createFloatingLine(dimension.scrollYWidth),
      };
}