Hey guys,
I'm currently working newly with the kendo spreadsheet. Default amount of rows is 200 and I can define it programatically, I know.
My spreadsheet has a datasource. Is there a smart solution to handle the count of rows by it's datasource? So if the datasource has 400 elements, that my spreadsheet increase the rows?
Best Regards,
Daniel
@(Html.Kendo().Spreadsheet()
.Name("bestandsliste")
.HtmlAttributes(new { style = "width:100%" })
.Sheets(x =>
{
x.Add()
.Name("Bestandsliste")
.DataSource<Fahnenbestand>(y => y
.Custom()
.Transport(z => z.Read("spreadsheet_onRead"))
);
})
.Sheetsbar(false)
.Toolbar(false)
)
function spreadsheet_onRead(options) {
$.ajax({
url: `@ViewData[ViewDataVariables.UrlWebApi]/FlagCategory/GetOverviewAllFlagsAsSpreadsheet`,
headers: { 'Authorization': '@token' },
success: function (result) {
console.log(options);
console.log(options.rows);
options.success(result.Data);
},
error: function (result) {
options.error(result);
}
});
}
Found a solution :)
function spreadsheet_onRead(options) { $.ajax({ url: `@ViewData[ViewDataVariables.UrlWebApi]/FlagCategory/GetOverviewAllFlagsAsSpreadsheet`, headers: { 'Authorization': '@token' }, success: function (result) { var sheet = kendoSpreadSheetBestandsliste.activeSheet(); sheet.resize(result.Total, 3); options.success(result.Data); }, error: function (result) { options.error(result); } }); }
Hi Daniel,
Thank you for sharing your solution with the community. It is greatly appreciated.
Indeed, utilizing the resize method would expose the ability to incorporate a new number of rows, as well as columns.