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

Complex layout - load data

7 Answers 119 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
NS
Top achievements
Rank 1
NS asked on 21 Dec 2016, 08:41 AM

Hi,

In one scenario, I used a javascript Ajax call to get data and then I constructed my sheet like this:

var sheet = spreadsheet.insertSheet({ rows: total });

sheet.setDataSource(data);

This way, the columns and rows are constructed by following the format defined in the JSON in data.

Now ... see the attached screenshot. Is it even remotely possible to get a following excel layout using the approach above? I can re-construct the layout without loading data, but in an ideal world, the user would get a spreadsheet without data (but containing the columns layout), and then using some filters outside the spreadsheet, x-number of columns (with the salmon background) would be added. Customers, etc (with green background) would be added.

Is there an alternative to setDataSource to bind data to a starting cell/row, etc.

Thanks,

Nicolas

7 Answers, 1 is accepted

Sort by
0
Veselin Tsvetanov
Telerik team
answered on 22 Dec 2016, 01:23 PM
Hello Nicolas,

The required complicated layout of the Spreadsheet could be achieved by loading an xlsx (or JSON) to the Spreadsheet widget. Unfortunately, you won't be able to achieve similar layout, when using the DataSource of the Spreadsheet Sheets. The reason for that is the fact that you will be able to pass only data (array of similar objects) and no formatting options at all.

Regards,
Veselin Tsvetanov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
NS
Top achievements
Rank 1
answered on 11 Jan 2017, 10:35 AM

Is there a way to limit the default number of rows and columns if you construct the spreadsheet by loading json using the widget?

e.g. my SpreadsheetSheet C# object has 10 rows and 8 columns, but the widget is rendered to column AX and has 200 rows. Is there a way to avoid this or disable those cells?

 

0
Veselin Tsvetanov
Telerik team
answered on 12 Jan 2017, 02:54 PM
Hello Nicolas,

You could set the number of rows and columns to be initially loaded in a Spreadsheet by specifying them in the JSON:
var json = '{ "activeSheet": "Products", "columns": 5, "rows": 5, "sheets": [{ "name": "Products", "rows": [] }] }';
var object = JSON.parse(json);
var spread = $("#spreadsheet").data('kendoSpreadsheet');
spread.fromJSON(object);

Here you could find a simple implementation of the above.

Regards,
Veselin Tsvetanov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
NS
Top achievements
Rank 1
answered on 13 Jan 2017, 02:59 PM

The ViewBag method works when using a MVC controller that is of type HTTPGET.

If I use a $Ajax javascript, that calls a controller using HTTPOST, the spreadsheet is not rendered on the page.

Strangely enough, if I look at the source of my webpage (after rendering), the JSON of the spreadsheet is in the source of the page ... any idea what could be causing this? (or should I submit an eticket for this)

 

Thanks,

0
Veselin Tsvetanov
Telerik team
answered on 16 Jan 2017, 09:36 AM
Hello Nicolas,

May I ask you to share here the view and the controller code that causes the issue observed?

Regards,
Veselin Tsvetanov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
NS
Top achievements
Rank 1
answered on 16 Jan 2017, 12:03 PM

Hi,

I submitted e-ticket 1084269 (with demo project attached) to reproduce the issue.

0
Veselin Tsvetanov
Telerik team
answered on 17 Jan 2017, 03:56 PM
Hi Nicolas,

I have answered to your question in the support ticket, that you have opened. In case you have any further questions on the same topic, I would suggest you to continue our communication there.

Regards,
Veselin Tsvetanov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Spreadsheet
Asked by
NS
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
NS
Top achievements
Rank 1
Share this question
or