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

[Solved] Client-side events prevet Ajax requests from working

2 Answers 61 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Luke
Top achievements
Rank 1
Luke asked on 25 May 2011, 11:05 PM
Hi, I'm having some trouble using both Ajax requests and Client-side events.

In the below block of code, uncommenting the ".ClientEvents" part causes the ajax to stop working. Sorting by column reloads the whole page, filtering is impossible, and the delete links no longer function properly. As is, however - with the ClientEvent part commented out - they all work fine.

@(Html.Telerik().Grid(Model)
        .Name("Grid")
        .DataKeys(dataKeys => dataKeys.Add(o => o.Id))
        .Columns(columns =>
        {
            columns.Command(commands => commands.Delete()).Width(50);
            columns.Bound(o => o.Info.Name).Title("Name").Width(100);
            columns.Bound(o => o.Info.LastUserName).Title("User name").Width(50);
            columns.Bound(o => o.Info.Model).Title("Device model").Width(100);
            columns.Bound(o => o.Info.PushNotificationTypes).Title("Notification").Width(50);
            columns.Bound(o => o.Info.PhoneNumber).Title("Phone number").Width(100);
            columns.Bound(o => o.Info.OSVersion).Title("OS version").Width(50);
            columns.Bound(o => o.Info.SoftwareVersion).Title("Client version").Width(100);
            columns.Bound(o => o.Info.LastAccess).Title("Last logon").Width(100);
            columns.Bound(o => o.Info.LastNotification).Title("Last notification").Width(100);
        })
        .DataBinding(dataBinding =>
        {
            dataBinding.Server().Select("Devices", "Monitoring", new { ajax = true });
            dataBinding.Ajax()
                    .Select("_Devices", "Monitoring")
                    .Delete("_DevicesDelete", "Monitoring");
        })
        /*.ClientEvents(events =>events
                .OnDataBound("updateTitle"))*/
        .Scrollable(scrolling => scrolling.Enabled(true))
        .Sortable(sorting => sorting.Enabled(true))
        .Pageable(paging => paging.Enabled(true))
        .Filterable(filtering => filtering.Enabled(true))
        .Groupable(grouping => grouping.Enabled(true))
        .Footer(true)
)

The "updateTitle" script updates the text in the page's header, which contains a count of how many records are currently in the grid.
Please let me know if you need me to paste more code/provide additional info.

Thanks for any help,
Luke

btw, I came across this question which sounds similar, but I'm not certain if it's a related issue:
http://www.telerik.com/community/forums/aspnet-mvc/grid/client-events-prevents-ajax-select-from-working.aspx

2 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 26 May 2011, 07:04 AM
Hello Luke,

 Something in the updateTitle is causing the problem. Probably  a JavaScript error. You can start by commenting lines from updateTitle and see when it will start working.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Luke
Top achievements
Rank 1
answered on 26 May 2011, 08:37 PM
Got things together; thanks for setting me on the right track.
Tags
Grid
Asked by
Luke
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Luke
Top achievements
Rank 1
Share this question
or