pandastable icon indicating copy to clipboard operation
pandastable copied to clipboard

getSelectedRowData using handle_left_click

Open nira123 opened this issue 3 years ago • 0 comments

Hi Damien, I have seen solution given to override some methods. I need to get selected row data while moving through rows (i.e left click ) and delete selected row with delete button if necessary. I noticed there is a method called getSelectedRowData() and handle_left_click(self, event). How do I bind getSelectedRowData() to left click such that I get selected row data without effecting to pandas table features?

I used following code with directly overriding rowheader.bind and pt.bind . It is not working as expected.

  
        pt.bind("<Delete>", pt.deleteRow)
        pt.rowheader.bind('<Button-1>',self.handle_left_click)    
        
            
    def handle_left_click(self,event):
        """Handle left click"""
        rowclicked_single = pt.get_row_clicked(event)
        pt.setSelectedRow(rowclicked_single)
        print(pt.getSelectedRowData())
        pt.redraw()

Could you please provide some suggestions to implement this if you do not mind. Many thanks.

nira123 avatar Oct 24 '22 14:10 nira123