Reputation: 361
I am using dojo dgrid for table representation. I have handled a row click event with grid.on('.dgrid-content .dgrid-row:click', function(){ // Open a Dialog})
. But the problem I am facing here is: while user is trying to select any text on the row with a hope to copy, the event eventually ends up opening the dialog.
As per my knowledge, HTML5 has the support of ondrag
event, but that is not working in my case. What are the other ways to separate these two events and handle accordingly?
Thanks in advance.
Upvotes: 3
Views: 277
Reputation: 925
You can distinguish select from click in following way inside of your click handler:
clickHandler: function () {
var collapsed = window.getSelection().isCollapsed;
if (collapsed) {
console.log("Clicked");
//Open dialog
} else {
console.log("Selected");
//Do something else
}
}
Upvotes: 2
Reputation: 2635
You should add set allowTextSelection
to true
inside your grid. This allows the user select text inside the rows.
Make sure you read the documentation on the topic.
Upvotes: 0