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

RadGrid RowDblClick - can you find the columnindex?

1 Answer 159 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 25 Oct 2011, 10:49 PM
In RadGrid RowDblClick, I want to put the row in edit mode only if the user clicks certain cell columns in my grid (only if they click one of the non-readonly columns, for example). How can I alter it to conditionally inspect which column was clicked?
function RowDblClick(sender, eventArgs) {
    // inspect what column was clicked
    // if (columnindex in (3,6,7) { -- user clicked one of our editable columns, so allow edit
        sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
     // }
}

Or would it be possible to use a cell dbl-click event instead of row's dbl-click event, if such an event for cells exists?

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 28 Oct 2011, 12:41 PM
Hi David,

Thank you for contacting us.

In order to achieve your goal you could get the cell index of the clicked row. You could use the following code:
function RowDblClick(sender, eventArgs) {
var cellIndex = eventArgs._domEvent.target.cellIndex;
switch (cellIndex) {
case 3:
sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
break;
case 6:
sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
break;
case 7:
sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
break;
}
}

Let me know if this is working for you.

All the best,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
General Discussions
Asked by
David
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or