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

Remove event firing incorrectly

6 Answers 204 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vince
Top achievements
Rank 1
Vince asked on 03 Jul 2018, 08:25 PM

https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/events/remove

I am using the above event to refresh other grids on the page when a specific grid has a row deleted.

My test code is as follows:

@(Html.Kendo().Grid<ViewModel>
    ()
    .Name("kGrid")
    .Events(e => {
        e.Remove("alert('hello')");
    })

 

The rest of the code is omitted as it is not relevant.

The "hello" is triggering on page load, and not triggered at all when a row is confirmed removed. Am I missing something? 

6 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 05 Jul 2018, 06:00 AM
Hello, Vince,

The event is expecting a function name to be pass to it.

Please pass a function and set the alert inside the function.

The expected syntax can be observed here:

https://demos.telerik.com/aspnet-mvc/grid/events

If the issue still occurs, please provide an example as it could be caused by a factor which we are overlooking at this moment.

Regards,
Stefan
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Vince
Top achievements
Rank 1
answered on 05 Jul 2018, 12:42 PM

https://developer.mozilla.org/en-US/docs/Web/API/Window/alert

Alert is a function/method.

How I found this bug originally was trying to fire the event in a far more complicated grid using a different method/function. I then tried the remove event on a very simple grid using the alert function/method and found the same bug.

I'd suggest you guys testing this on your end and if it does work, shoot me a git repo that I can pull down and test myself. Right now all signs point to your source code. But I'd be very happy to be wrong!

0
Stefan
Telerik team
answered on 06 Jul 2018, 06:43 AM
Hello, Vince,

I made an example using the remove event and it was fired as expected on my end.

Please check the example for reference is there is a difference between the real application.

If the issue still occurs, please provide an example reproducing the issue and I will gladly assist further.

Regards,
Stefan
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Vince
Top achievements
Rank 1
answered on 06 Jul 2018, 02:47 PM

I've used your example and found the same "bug."

.Events(events => events.Remove("onRemove"))

The above triggers correctly.

.Events(events => events.Remove("onRemove()"))

The above will not.

How do we pass arguments into the method then?

0
Stefan
Telerik team
answered on 09 Jul 2018, 06:08 AM
Hello, Vince,

Thank you for clarifying how the event is set.

The described behavior is expected as the Grid events expect a function name and not a direct function.
Also, they are internally triggered with predefined parameters and passing additional parameters is currently not supported.

The available parameters for the remove event can be observed here:

https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/events/remove

If these parameters are not helpful in the real application, please share with us the use case and we will check if the desired value can be retrieved inside the event during execution.

Regards,
Stefan
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Vince
Top achievements
Rank 1
answered on 09 Jul 2018, 05:26 PM

Thanks for the clarification Stefan.

My confusion came from the fact that some Kendo methods allow passing a function name with arguments, similar to actually invokinga method. This created the incorrect assumption that all Kendo methods can do this.

Tags
Grid
Asked by
Vince
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Vince
Top achievements
Rank 1
Share this question
or