qgrid
qgrid copied to clipboard
Cannot highlight or copy cells from table
Environment
- Operating System: 'Linux-4.4.0-1020-aws-x86_64-with-Ubuntu-16.04-xenial'
- Python Version: Python 2.7.12
- How did you install Qgrid:
pip - Python packages:
qgrid==1.0.5,notebook==5.5.0 - Google Chrome Version: 67.0.3396.87
Description of Issue
I cannot highlight or copy cells from the qgrid table even with grid_options={'enableTextSelectionOnCells': True} set.
Reproduction Steps
>>> import pandas as pd
>>> import qgrid
>>> data = pd.DataFrame({'a': (1, 2, 3), 'b' : (4, 5, 6)})
>>> qgrid.show_grid(data, grid_options={'enableTextSelectionOnCells': True})
Then try to click and drag on the numbers in the table.
I am doing this within a notebook with the ultimate aim to use the notebook in dashboard form.
What steps have you taken to resolve this already?
I have tried to inspect the element to see if any options (e.g., enableTextSelectionOnCells) are not being set or being set incorrectly but I cannot see anything referencing any resemblance of this option. I've looked through previous issues but cannot find anything similar.
Thanks for the report...seems worth fixing, especially the copying part.
Hi, Is this issue has been fixed or is there any workaround to highlight cell contents?
@vishma The enableTextSelectionOnCells option only works if the editable grid option is set unfortunately. My workaround was to set the editable grid option to True and setup this callback:
self.widgets['jobs_qgrid'].on('cell_edited', self._qgrid_edited)
def _qgrid_edited(self, event, qgrid_widget):
if event['source'] == 'gui':
qgrid_widget.edit_cell(event['index'], event['column'], event['old'])
This allows users to copy cell contents without changing the content of the cells.