EasyUI Forum
May 14, 2024, 12:01:33 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [Solved] Right Click to show Context Menu on Datagrid Cell  (Read 5200 times)
kifni41
Newbie
*
Posts: 23


View Profile
« on: November 04, 2019, 12:55:07 AM »

Hi,

I'm trying easyui ract, previously i already use the jquery version for couple of my project.

One of the function that i still havent find a way to implement in react version, is to show context menu when user do right click on datagrid cell.

I already check the documentation, get find this event listed on GridBase component

Code:
onCellContextMenu	{row, column, originalEvent}

But when i tried to catch that event, i can only get the row & column parameter, and originalEvent parameter is always null.

I believe this originalEvent is the one that i can use to get the x & y coordinate so I can show the context menu on the area near the cell.

Anyone ever tried this?
Or is it possible to get the x&y axis from datagrid component with column & row information?



Thanks

« Last Edit: November 11, 2019, 09:11:09 PM by kifni41 » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: November 04, 2019, 08:26:09 PM »

Please refer to the code below:
Code:
handleCellContextMenu({row,column,originalEvent}){
originalEvent.preventDefault()
console.log(originalEvent)
}

<DataGrid data={this.state.data} style={{height:250}}
  onCellContextMenu={this.handleCellContextMenu.bind(this)}
>
Logged
kifni41
Newbie
*
Posts: 23


View Profile
« Reply #2 on: November 05, 2019, 12:12:57 AM »

Thanks mate, solved

we miss the curly bracket, didn't realize it one parameter as an object, and tried with 3 parameter.


 Smiley
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!