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

this.select() is not a function?

2 Answers 2111 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 23 Jun 2015, 10:37 AM

Hi there,

 

I am trying to test some example code that I have found and one of these samples clears the selection if a grid has detail sections, so only one line is highlighted at a time.

 

The example is below..

 

function onRowSelect(e) {

    var selected = this.select();
            
    $('.k-grid tbody>.k-state-selected').not(selected).removeClass('k-state-selected')
}

 

and on the grid using 

 

.Events(e => e.Change("onRowSelect()"))

 

I am using MVC and the latest builds (trials).

 

I get the error when the page loads Uncaught TypeError: this.select is not a function

 

Can anyone point me to why this error is occurring?

 

Regards

Jason

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimiter Madjarov
Telerik team
answered on 23 Jun 2015, 12:35 PM

Hello Jason,

You should remove the brackets from the change event handler definition, because currently it will be invoked during initialization.
E.g.

.Events(e => e.Change("onRowSelect"))

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Jason
Top achievements
Rank 1
answered on 23 Jun 2015, 08:17 PM
Thank you that was it, I'm quite new to javascript so good one to learn!
Tags
Grid
Asked by
Jason
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Jason
Top achievements
Rank 1
Share this question
or