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

refresh button in grid is not loading data for current dataitems ,if we use Kendo Grid + DropDownlist

2 Answers 369 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Swarna Priya
Top achievements
Rank 1
Swarna Priya asked on 09 Dec 2015, 10:15 AM

Hi All,

I am using one grid and dropdown list. whenever the dropdown list changes then grid should get reloaded with new. it is working fine for me if i use below code in the drop down change event, but i have made the default refresh button of grid as true.

Hence when i click on refresh button in grid it is not loading with data for current dataitem selected in dropdown. it is only loading the which got loaded in grid for the first time.
please reply ASAP , as this is stopping my work.
change: function (e) {
                    $("#" + gridname).data("kendoGrid").dataSource.read(getAuditparamter("WorkDetails"));
                    }
 $('#' + gridname).kendoGrid({
                dataSource: {
                    transport: {
                        read: {
                            url: window.environment.siteRootUrl + "url",
                            data: getAuditparamter(gridName),
                            dataType: "json",
                            cache: false
                        }
                    },
                    pageSize: 25,
                    serverPaging: true,
                    sort: {
                        field: "EventDate",
                        dir: "desc"
                    }
                }

  function getAuditparamter(gridname) {
            
            if (gridname == "WorkDetails") {
                var ddlTaskName = $("#ddl" + gridName).data("kendoDropDownList").text();
                return { id : workId,taskName: ddlTaskName.trim()};
                
            }
        }

2 Answers, 1 is accepted

Sort by
0
Accepted
Alexander Valchev
Telerik team
answered on 11 Dec 2015, 10:01 AM
Hello Swarna,

Currently you are passing the parameter through the read method. The problem however is that the build-in refresh button calls the read method without parameters.

In order to resolve the issue I suggest to use the parameterMap of the DataSource to add the DropDownList value to the read request. The parameterMap will execute when you call the read request manually but also when the refresh button calls it.

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Swarna Priya
Top achievements
Rank 1
answered on 15 Dec 2015, 06:25 AM

Thanks Alex..

This worked perfect..

Tags
Grid
Asked by
Swarna Priya
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Swarna Priya
Top achievements
Rank 1
Share this question
or