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

Apply shared datasource to kendo grid MVC

4 Answers 39 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sandy
Top achievements
Rank 1
Iron
Veteran
sandy asked on 01 Dec 2020, 07:48 AM

Hi.

i have a data source (which contains 2 columns and  it contains around 50 rows only) and applied to kendo multi select and keno column chart.

now i want to apply same data source to kendo grid mvc with aggrigate functions and paging options.

4 Answers, 1 is accepted

Sort by
0
sandy
Top achievements
Rank 1
Iron
Veteran
answered on 01 Dec 2020, 08:14 AM
am using this multislect as filter to filter chart values. now i want to apply same filters and data saource to grid
0
Anton Mironov
Telerik team
answered on 02 Dec 2020, 02:44 PM

Hi Sandy,

In order to achieve the required behavior, I tried to implement the desired behavior. The result could be found in a sample project attached that could be used as a template.

The Multiselect is using a simulated DataSource equal to the DataSource of the Kendo UI Grid. This is needed because of the filtering word ("text" in the Controller of the example). 

Handle the "Change" Event of the MultiSelect. In the event handler, build a custom filter for the DataSource of the Grid. Here is an example:

.Events(e => e.Change("onChange"))

    function onChange(e) {
        var multiSelectValue = e.sender.value();

        var gridDataSource = $("#grid").data("kendoGrid").dataSource;

        // Values to exclude
        var filterArray = multiSelectValue

        // Create custom filter with 'or' logic
        var _fllter = { logic: "or", filters: [] };

        // Create and get custom filter for every value in your array with operator 'neq'(not equal)
        for (var i = 0; i < filterArray.length; i++) {
            _fllter.filters.push({ field: "OrderID", operator: "eq", value: filterArray[i] });
        }

        // Apply the filter
        gridDataSource.filter(_fllter);
    }
Give the approach above a try and let me know if further assistance is needed.

 

Kind Regards,
Anton Mironov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
sandy
Top achievements
Rank 1
Iron
Veteran
answered on 03 Dec 2020, 03:56 AM

Hi Anton,

Thanks for your reply.

here am explaining my requirements.

1 datasource

1 multi select  with read option

1 chat with above data source

1 grid with above data source.

in grid i need to display sum of one column in footer and need to provide paging option.

i need to filter values according to combo box values and need to display that filter values in grid and chart.

my problem here is if i apply paging to grid, only that paging values are displaying in kendo chart. but i dont want to display few values in chart. i want to display all values in chart and apply paging and sum option to grid only.

i dont have problem in filtering values. i have problem in grid paging and sum of column.

 

 

0
Anton Mironov
Telerik team
answered on 04 Dec 2020, 02:55 PM

Hello Sandy,

Probably, the reason for the pointed faulty behavior is that the paging filter is sending to the DataSource request when loading the Chart.

The fastest route to getting you up and running is if you could provide a runnable, isolated, sample project. Examining this project will let us replicate the issue locally and further troubleshoot it.

The project from my previous reply could be used as a template. Try to replicate the issue and send it back to me in this thread. I will try my best to resolve it.

Looking forward to hearing back from you.

 

Best Regards,
Anton Mironov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
sandy
Top achievements
Rank 1
Iron
Veteran
Answers by
sandy
Top achievements
Rank 1
Iron
Veteran
Anton Mironov
Telerik team
Share this question
or