Home > front end >  Datatables how to bind button click event for right?
Datatables how to bind button click event for right?

Time:09-27

The front white one
There is now a demand is a column of datatables, right-click the can open a right-click menu
At first the idea is to add a render in this column, put a hidden div render, then by div to obtain click position, because of the need to right-click menu + obtain click on the location of the data
The results did not succeed, because can't give each row in the column binding a separate id, there are too many data
Then considering the click event of datatables, if we can change the mouse the left key click events to right-click can perfectly realize the
So I want to ask bosses, how can change the mouse the left key click event of datatables to right-click
Or ever bosses have better ideas, very grateful!

CodePudding user response:

Document. The getElementById (" test "). onm ousedown=function (e) {
If (e.b utton==2) {
Alert (" you some right ");
} else if (e.b utton==0) {
Alert (" you ordered left ");
} else if (e.b utton==1) {
Alert (" you ordered roller ");
}
}

CodePudding user response:

references a 1/f, sugar packets boy reply:
document. The getElementById (" test "). The onm ousedown=function (e) {
If (e.b utton==2) {
Alert (" you some right ");
} else if (e.b utton==0) {
Alert (" you ordered left ");
} else if (e.b utton==1) {
Alert (" you ordered roller ");
}
}


Brother, you didn't see a problem carefully ah, really want to so simple that can be very good

CodePudding user response:

DataTable doesn't work for a long time, personal advice did first look at the document on the corresponding configuration items or API
Or just write a global right click on the event, through the bubbling interceptor
I hope it can help you
  • Related