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
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
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?
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
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,
May I ask you to share here the view and the controller code that causes the issue observed?
Regards,
Veselin Tsvetanov
Telerik by Progress
Hi,
I submitted e-ticket 1084269 (with demo project attached) to reproduce the issue.
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