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

PivotGrid with flat dynamic objects

3 Answers 204 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Maxim
Top achievements
Rank 2
Maxim asked on 22 Jun 2016, 06:44 PM

Hello,

 

We have list of flat POJO objects, where objects are dynamic, we don’t know their list of fields/properties at design time. In Silverlight version of telerik Pivot grid we were able to populate list of fields and provide list of objects so that users can create columns, rows and measures at run time.Is this approach feasible with Kendo UI Pivot? Or do we have to define model and cube with dimensions and measures in advance? An example would be very useful.

 

Thank you, Sergey

3 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 24 Jun 2016, 10:04 AM
Hello Sergey,

In general, you can build the dimensions collection of the DataSource dynamically using the fields of the POJO instance. Here is a Dojo demo that demonstrates how this could be done: Please note that this is a custom approach and it is up to the developer responsible for the feature to handle it accordingly.

Regards,
Georgi Krustev
Telerik
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
0
Maxim
Top achievements
Rank 2
answered on 29 Jun 2016, 12:58 AM

Hello Georgi,

Thank you, it is what I was looking for. However, setDataSource() only works for me once. I'm not able to update data source and I need to change number of records on demand. For an example, try to add button and call this function in your Dojo:

    var that = this;
    var getProducts = function () {
        $.getJSON("http://demos.telerik.com/kendo-ui/service/Northwind.svc/Products?$format=json", function (data) {
            var source = that.buildDataSource(data.d);
            $("#pivotgrid").kendoPivotGrid().data("kendoPivotGrid").setDataSource(source);
            $("#configurator").kendoPivotConfigurator().data("kendoPivotConfigurator").setDataSource(source);
        });
    }

Thanks again,

Sergey

0
Maxim
Top achievements
Rank 2
answered on 29 Jun 2016, 12:54 PM

Hi Georgi,

This issue is resolved by using static variables for the pivot grid and configurator and initializing them only once in controller's constructor.

Thank you,

Sergey

Tags
PivotGrid
Asked by
Maxim
Top achievements
Rank 2
Answers by
Georgi Krustev
Telerik team
Maxim
Top achievements
Rank 2
Share this question
or