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

Kendo grid doubts

1 Answer 19 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Palanisamy
Top achievements
Rank 1
Palanisamy asked on 10 Sep 2015, 07:41 AM

HI in kendo grid page change event,If we keep ajax call,pagination first time only working.After that not at all working.Kindly provide the solution.Below is my code

 

var grid = $("#xmlgrid").data("kendoGrid");
              
                var pager = grid.pager;
                pager.bind('change', test_pagechange);
                
                var pageSizeDropDownList = grid.wrapper.children(".k-grid-pager").find("select").data("kendoDropDownList");
                pageSizeDropDownList.bind('change', test_pagesizechange);

                function test_pagechange()
                {
                    var curr_pageno = grid.dataSource.page();
                    var curr_pagesize = grid.dataSource.pageSize();
                    var localxmldetails = [];
                    if (curr_pageno == 1)
                    {
                        alert("page 1 is clicked");
                        
                        localxmldetails = common_1stpage_dropdownchange();
                        
                        bindingToDatasource(localxmldetails);
                        //alert(JSON.stringify(localxmldetails));
                        //mainxmldetails = localxmldetails;
                        //alert(JSON.stringify(mainxmldetails));

                    }
                    else
                    {
                        $.ajax({
                            type: "GET",
                            url: "/WC3/Resources/XML/ClientDetails.xml",
                            dataType: "xml",
                            async:false,
                            success: function (xml) {

                                var i = 0, ClientID, ClientName, AppDesc, WC3ClientKey, startval, endval;

                                startval = (curr_pageno - 1) * (curr_pagesize) + 1;
                                endval = (startval + curr_pagesize) - 1;
                                $(xml).find('Values').each(function () {

                                    i++;

                                    if (i >= startval && i <= endval) {
                                        localxmldetails.push({ ClientID: $(this).find('ClientID').text(), ClientName: $(this).find('ClientName').text(), AppDesc: $(this).find('AppDesc').text(), WC3ClientKey: $(this).find('WC3ClientKey').text() })
                                    }
                                    else {
                                        if (i < tp) {
                                            return true;
                                        }
                                        else
                                            return false;
                                    }
                                });
                                
                                //alert(JSON.stringify(xmldetailsLocal));
                            }

                        });
                        bindingToDatasource(localxmldetails);
                    }
                }​

1 Answer, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 11 Sep 2015, 03:36 PM

Hello Palanisamy,

if the pagination stops working for some reason, most likely a JavaScript error occurs - the ajax call itself does not seem related to the Grid functionality. However, I can't be certain about that. Is there a chance for you to isolate the problem in a runnable example? You can use our Dojo for that purpose. Thank you in advance. 

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Palanisamy
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Share this question
or