Telerik Forums
UI for ASP.NET MVC Forum
1 answer
104 views

Hi,

I'm looking for some guidance on the best way to pivot data that is being returned from a .NET MVC controller. I'm able to read it into the regular grid by doing the following :

 

 @(Html.Kendo().Grid<Project.Models.viewMyModel>()
    .Name("grid")
    .ToolBar(tools => tools.Excel())
    .Columns(columns =>
    {

        columns.Bound(p => p.Field1).Width("auto");
        columns.Bound(p => p.Field2).Width("auto");
        columns.Bound(p => p.Field3).Width("auto");
        columns.Bound(p => p.Field4).Width("auto");

    })
       .Excel(excel => excel
       .FileName("Report1.xlsx")
       .ProxyURL("Report?handler=Save")
       .AllPages(true)
       )
    .Height(550)
    .AutoBind(false)
    .Pageable() 
    .Sortable()
    .Scrollable()
    .Resizable(r => r.Columns(true))
    .Filterable()
    .DataSource(dataSource => dataSource
    .Ajax()
    .Read(read => read.Action("GetSummary", "Reports").Data("getParams"))
    .PageSize(100)
    .ServerOperation(false)
    )
    .Events(ev => ev.ExcelExport("onExcelExport"))
    .NoRecords(n => n.TemplateId("no-records-template-id"))
    )

The form post submits some date parameters to the 'GetSummary' controller and returns the json data source for the grid.

I would like to pivot these results so that Field1 results are my column headers and the other fields are my rows. Would PivotGrid be a good option or is that overkill? If so - I wasn't sure how to get it to read the json results as as I did with the grid above. Or would you suggest I pivot/manipulate the data beforehand and continue to read with the traditional grid method?

Thanks,
Adam

     
Ivan Danchev
Telerik team
 answered on 29 Sep 2022
0 answers
132 views
1 answer
66 views

I'm new to the Telerik/Progressive framework, so please excuse me if I am asking something too obvious.

I have created a RadPivotGrid (code excerpt below and image attached). Whilst this works really well to display an aggregate COUNT and also shows the Row Sub Totals, I am at a loss on how to make the percentages show for the items based on the row sub total.

To give context; this is to display Survey Data. The rows are populated by Question and Answer, and the Columns provides a count on the number of people who answered. e.g.,

What is your favourite colour
   Red                                                     10
   Blue                                                    20
Total People in RowSubTotal             30

What is your favourite shape
  Square                                                 20
  Triangle                                               15
Total People in RowSubTotal              35

What I want to be able to do, is view this by percent based on the row subtotal

What is your favourite colour
   Red                                                        33%
   Blue                                                       66%
Total People in RowSubTotal               100%

Below is the snippet from RadPivotGrid. I have tried to use TotalFormat-TotalFunction="PercentOfRowTotal" in the PivotGridAggregateField, but this provides a percentage of the whole Grid, not the individual question (RowSubTotal).

Appreciate any help!

<telerik:RadPivotGrid runat="server" ID="RadPivotGridCrossTab" DataSourceID="SqlCrossTab" Skin="Bootstrap" Height="100%"
AllowFiltering="False" ShowColumnHeaderZone="False" ShowDataHeaderZone="False" ShowRowHeaderZone="False" ShowFilterHeaderZone="false" ColumnHeaderTableLayout="Fixed" RowHeaderTableLayout="Fixed" AllowNaturalSort="true">
<SortExpressions>
<telerik:PivotGridSortExpression FieldName="Filters" SortOrder="None" />
</SortExpressions>
<PagerStyle Mode="Slider" ChangePageSizeButtonToolTip="Change Page Size" AlwaysVisible="True" PageSizeControlType="RadComboBox"></PagerStyle>
<ClientSettings EnableFieldsDragDrop="true">
<Scrolling AllowVerticalScroll="true"></Scrolling>
</ClientSettings>
<ConfigurationPanelSettings EnableDragDrop="False" EnableFieldsContextMenu="False"></ConfigurationPanelSettings>
<RowHeaderCellStyle  Font-Names="Rubik" BackColor="#3D1A6F" ForeColor="White"></RowHeaderCellStyle>
<ColumnHeaderCellStyle Font-Bold="True" Font-Names="Rubik" BackColor="#3D1A6F" ForeColor="White"></ColumnHeaderCellStyle>
<DataCellStyle Width="250px" Font-Names="Rubik" CssClass="text-center" />
<TotalsSettings RowsSubTotalsPosition="First" RowGrandTotalsPosition="None" ColumnsSubTotalsPosition="None" ColumnGrandTotalsPosition="None"></TotalsSettings>
<Fields>
<telerik:PivotGridColumnField UniqueName="Filters" DataField="Filters"></telerik:PivotGridColumnField>
<telerik:PivotGridRowField UniqueName="Question" DataField="Question" CellStyle-Width="350px"></telerik:PivotGridRowField>
<telerik:PivotGridRowField UniqueName="Answer" DataField="Answer" CellStyle-Width="350px"></telerik:PivotGridRowField>
<telerik:PivotGridAggregateField DataField="Respondent" Aggregate="Count" ></telerik:PivotGridAggregateField>
</Fields>
</telerik:RadPivotGrid>

Attila Antal
Telerik team
 answered on 12 Apr 2022
0 answers
59 views

Hi

I've explored the use of Moq. I found it useful, except for the fact that it relies heavily on code style that uses dependency injection. As I'm working on some existing legacy code, it can become quite the refactoring effort. The code base also includes some assembly references that could not be addressed via Moq.

Microsoft Fakes worked great IMHO. The only downside I saw was the requirement of VS Enterprise 2019. I'm not sure if I can get my employer to pay for the $5k/yr/developer. I really liked the ability to generate fakes on an assembly directly within VS.

Telerik's solution looks equally expensive. I've yet to explore it. Fakes, Stubs, and Mocks (telerik.com)

Prig looks viable, but looks like a pain to setup with powershell scripts, omegle etc.

Thanks

Jack
Top achievements
Rank 1
 updated question on 13 Dec 2021
1 answer
105 views

Hello,

 

I'm trying to use a pivotgrid where a ratio is calculated, but I can find a way to do it, as the Total is always wrong.

Example : I don't know how to calculate the cell with "?"

 

| Object 1                             | Object 2                             | Total Object                     |

| Value 1  |  Value 2 | Ratio | Value 1  |  Value 2 | Ratio | Value 1  |  Value 2 | Ratio |

01/01/2021      | 15           |  12          |  0.8    |  15          |  6          |  0.4     | 30          | 18           | ?        |

02/01/2021     | 16           |  10          |  0.625|  12          |  6          |  0.5     | 28          | 16           | ?        |

Total Date      | 31            |  22          |  ?       |  27          |  12         |    ?     | 58          | 34           | ?        |

 

Thanks for your help

Ivan Danchev
Telerik team
 answered on 02 Nov 2021
16 answers
320 views

Hi,

I have two columns Year and Month, these don't appear in order.

For example they display as Year: 2017, 2018, 2020, 2019. Then the Month: February, January, March, July eyc.

How can i sort these to appear in order?

Thanks,
Lee.

Heiko
Top achievements
Rank 1
Iron
Veteran
 answered on 23 Nov 2020
20 answers
215 views

Hi,

Not having much luck using this PivotGrid seems it very undeveloped.

How can i sort the Columns from A to Z?

Thanks,
Lee.

Grace
Top achievements
Rank 1
Veteran
 answered on 15 Nov 2020
3 answers
121 views

How to configure the kendo MVC pivot grid so that it doesn't repeat dimension labels?

I am following this https://demos.telerik.com/aspnet-mvc/pivotgrid?_ga=2.172892198.404272527.1601250445-647083974.1600781368 and built a kendo grid (see the attached screenshot A) but I would like to get rid of the dimension labels so that it doesn't take too much space(See the attached screenshot B). How should I configure it?

 

 

 

 

Eyup
Telerik team
 answered on 05 Oct 2020
5 answers
99 views
Is there a sample for using  returned by a controller as the MVC PivotGrid ?  I can't seem to get data to load in the although I see the getting fetched.
Nikolay
Telerik team
 answered on 13 Apr 2020
6 answers
184 views

I have an AnalysisServices Server Installed and i have created a cube in it. I need to add a pivotgrid into my site for browsing said cube.
My site is done using MVC controls and i have added an MVC Pivotgrid using the code below:

@(Html.Kendo().PivotGrid()
        .Name("pivotgrid")
        .ColumnWidth(200)
        .Height(570)
        .Filterable(true)
        .Sortable()
        .Configurator("#configurator")
        .DataSource(dataSource => dataSource
            .Custom()
            .Transport(transport => transport
                .Connection(connection => connection
                .Catalog("CatalogName")
                .Cube("CubeName"))
                //.Read(read => read
                //    .Url("RDC-35")
                //)
            )
            .Events(e => e.Error("onError"))
        )
)

 But i cannot understand where to put the server name. As far as i can tell i need to use .Read(x => x.Url("http://blah.blah") ). and that i need to have an http address for my server installed, as mentioned here: http://docs.telerik.com/kendo-ui/web/pivotgrid/overview

The PivotDataSource component communicates with OLAP cube instance on HTTP using the XMLA protocol
Is this the only way? Can't i use Adomd or ADO.NET?

 

P.S. i have found examples with code like the one below that imply using adomd is an option:

 <AdomdConnectionSettings Cube="Adventure Works" DataBase="Adventure Works DW 2008R2" ConnectionString="Data Source=http://demos.telerik.com/olap/msmdpump.dll;Catalog=Adventure Works DW 2008R2"></AdomdConnectionSettings>

Please forgive me if i have misunderstood anything, i am new to your controls and doing my best to understand them and start using them

Tsvetomir
Telerik team
 answered on 10 Apr 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
Iron
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
Iron
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?