Streamline JavaScript in RadGrid

I have a Telerik RadGrid nand in the Client Settings I have a row doublke click event that launches to JavaScript below.

I've used this script for years...
Just wondering, could this be streamlined a bit?

function OnRowDblClick(sender, eventArgs) {
    var grid = sender;
    var MasterTable = grid.get_masterTableView();
    var row = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()];
    var cell = MasterTable.getCellByColumnUniqueName(row, "id");
    var value = cell.innerHTML
    window.location.href = 'usersEdit.aspx?e=1&id=' + value; // Redirect the page           
    return;
}

Open in new window

Larry Bristersr. DeveloperAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Meir RivkinConnect With a Mentor Full stack Software EngineerCommented:
in my opinion it doesn't.
usually you would like to streamline part of code if it's too long or not readable or something which can provide same result but the code looks cleaner.
for instance, alot of jquery api are "streamlined" of old-fashion code, like selectors and traversing.

bottom line no need to streamline, code is neat.

cheers
0
 
Meir RivkinFull stack Software EngineerCommented:
which part of the code you wish to be "streamlined"?
the code is readable and straightforward, why would u want to change it?
0
 
Larry Bristersr. DeveloperAuthor Commented:
sedgewick,
  I'm not sure it does need to be streamlined...I'm not a JavaScript expert.

Hence...my question.
0
 
Meir RivkinFull stack Software EngineerCommented:
a good example of streamline is using switch instead of multiple if else.
or using $.each or $.grep instead of something like (for i=0;i<length;i++){}

its alot depends of the use case and the result you wish to produce from your code.
hope it was clear...
0
 
Larry Bristersr. DeveloperAuthor Commented:
Thanks.  I appreciate your comments.

Like a lot of .Net developers, my true knowledge of JavaScript is not extensive.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.