This is a migrated thread and some comments may be shown as answers.

[Solved] Approach to cancel onRowSelected based on column choice

2 Answers 76 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jason Finch
Top achievements
Rank 1
Jason Finch asked on 21 Apr 2010, 04:40 AM
I have a grid which has a hyperlink column input via a ClientTemplate.
I have wired up the onRowSelected event.

What I would like to know is how best cancel the onRowSelected event when the column with the hyperlink is triggered,  and let the event continue when any other non hyperlink column is clicked.

As at the moment, clicking the hyperlink causes a page get but also throws an error because onRowSelected is triggered as well.

Any help appreciated.
Thanks, Jason



2 Answers, 1 is accepted

Sort by
0
Jason Finch
Top achievements
Rank 1
answered on 21 Apr 2010, 05:19 AM
EDIT: Nope the onRowSelected still fires first.

Looks like the following snippet should help me out.

$("a").live('click'function(event) { 
event.stopPropagation(); 
  });  
0
Atanas Korchev
Telerik team
answered on 21 Apr 2010, 08:28 AM
Hi Jason Finch,

Row selection is using live events too and that event handler executes before yours. The solution I came up with is to use the onclick attribute of the link and stop propagation there:

function click(e) {
        $.Event(e).stopPropagation();
    }


columns.Template(o => { }).ClientTemplate("<a class='test' href='#' onclick='click(event)'>click</a>");

Greetings,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Jason Finch
Top achievements
Rank 1
Answers by
Jason Finch
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or