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

Using a combo box to refresh a grid

2 Answers 44 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 22 Dec 2013, 07:40 PM
I am very much a newbie with Kendo. I have worked with some examples and been able to populate a grid with data from my API.

I am trying to use a combo box to select the number of days of data to display, modify the API call and refresh the grid. Are there any examples or tutorials that cover that combination of controls?

Thanks in advance,

Rob

2 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 23 Dec 2013, 08:22 AM
Hello Robert,

Basically you need to send the values of those combo box to the server, and return the records based on these values. 

You should use the data function of the read configuration of the dataSource's transport or you can also pass the parameters directly to the read method of the dataSource:

 $('#myGrid').data().kendoGrid.dataSource.read({myCombo: $('#comboname').data('kendoComboBox').value()})


Kind Regards,
Petur Subev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Robert
Top achievements
Rank 1
answered on 24 Dec 2013, 04:46 PM
Thanks for the reply Peter,

What I was trying to do was build a URL and hit the API to get alternative data and display the results. I was able to do this as follows:

            $("#DaysDisp").change(function () {                              
                CBdays = DaysDisp.value
                dataU = "api/missionlist?days=" + CBdays
                //alert(dataU);
                $("#Mgrid").data("kendoGrid").setDataSource(
                    new kendo.data.DataSource({
                    type: "GET",
                    dataType: "json",
                    transport: {
                        read: dataU
                    },
                    pageSize: 10
                }))

Probably to verbose but it works.

Regards,

Rob
Tags
ComboBox
Asked by
Robert
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Robert
Top achievements
Rank 1
Share this question
or