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

this.select() onChange demo of Grid not working!!!

1 Answer 491 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Wonderer
Top achievements
Rank 1
Wonderer asked on 07 Nov 2012, 03:52 PM
Hi I'm just doing a simple task which is trying to get the selected row. I followed all the code stated in the demo site of the grid but unfortunately firebug is giving me an error saying that "this.select()" is not a method.

Here is the event for my grid.
>>>
.Events(events => events.Change(@<text> function(e){ OnChanged(e); } </text>))

And here is the script
>>>
    function OnChanged(e) {
        var selected = $.map(this.select(), function (item) {
            return $(item).text();
        });

As you can see I've used the @<text> in Change event because if I only specify the function name as string like this one
Events(events => events.Change("OnChanged") 

Firebug is complaining that Onchanged can't be found.


1 Answer, 1 is accepted

Sort by
0
David Beck
Top achievements
Rank 1
answered on 12 Nov 2012, 10:17 PM
Hi Wonderer,

Change you Syntax to this.

.Events(e => e.Change("onChanged"))
and JS to this
function onChanged(arg) {
            var selected = $.map(this.select(), function (item) {
                return $(item).text();
            });
 
            alert("Selected: " + selected.length + " item(s), [" + selected.join(", ") + "]");
        }
This should work Im am still working on find out how to get the ID/Value rather than the text but no luck so far
Tags
Grid
Asked by
Wonderer
Top achievements
Rank 1
Answers by
David Beck
Top achievements
Rank 1
Share this question
or