I am trying to update my spreadsheet based on the jsonData i get from my controller.
Controller data:
public ActionResult GetDoubleCombinations(Telerik.Web.Spreadsheet.Workbook jsonData, int id) { foreach (var sheet in jsonData.Sheets) { var columnCount = sheet.Columns.Count; var rowCount = sheet.Rows.Count; for (int i = 2; i < columnCount; i++) { var expressionTop = expressionService.GetExpressionByName(sheet.Rows[1].Cells[i].Value.ToString(), id); var parameterTop = expressionTop.FK_ParameterID; for (int j = 2; j < rowCount; j++) { var expressionLeft = expressionService.GetExpressionByName(sheet.Rows[j].Cells[1].Value.ToString(), id); var parameterLeft = expressionLeft.FK_ParameterID; if (parameterTop == parameterLeft) { var position = sheet.Rows[i].Cells[j]; position.Enable = false; position.Background = "#d3d3d3"; } } } } return Json(new { success = true, data = jsonData }); }
this is what i get in my view:
function getDoubleCombinations() { var spreadsheet = $("#matrix").data("kendoSpreadsheet"); const urlParams = new URLSearchParams(window.location.search); const id = urlParams.get('analysisId'); $.ajax({ url: "@Url.Action("GetDoubleCombinations", "Matrix")", data: JSON.stringify({ jsonData: spreadsheet.toJSON(), id: id }), contentType: "application/json", type: "POST", success: function (response) { spreadsheet.fromJSON(response.data); }, error: function () { alert("Error loading data."); } }); }
I use "spreadsheet.fromJSON" to update my spreadsheet.
My spreadsheet:
@model Telerik.Web.Spreadsheet.Workbook @(Html.Kendo().Spreadsheet() .Name("matrix") .HtmlAttributes(new { style = "width:100%" }) .BindTo(Model) .Toolbar(t => { t.Home(h => { h.Clear(); h.ExportAs(); }); t.Data(false); t.Insert(false); }) )
My problem is, that the spreadsheet is not updated.
In the attachement i have a screenshot of my jsonData.
Hello, I am trying to make a function that can resize my spreadsheet sheet dynamically based on the data, which is load on the sheet.
I know that the Spreadsheet has a function called "resize". I pass the numbers of columns and rows with a ViewBag, from the controller to the View on JS.
Controller:
public ActionResult Menus_Read([DataSourceRequest] DataSourceRequest request)
{
try
{
List<MenuViewModel> menus = db.GetMenus();
DataSourceResult result = menus.ToDataSourceResult(request);
ViewBag.RowCount = menus.Count;
ViewBag.ColumnCount = typeof(MenuViewModel).GetProperties().Length;
return Json(result, JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
ModelState.AddModelError(string.Empty, ex.Message);
return Json(new[] { new object() }.ToDataSourceResult(request, ModelState), JsonRequestBehavior.AllowGet); ;
}
}
JS:
$(document).ready(function() {
var rowCount = @(ViewBag.RowCount);
var columnCount = @(ViewBag.ColumnCount);
var spreadsheet = $("#spreadsheet").data("kendoSpreadsheet");
var sheet = spreadsheet.activeSheet();
sheet.resize(rowCount, columnCount);
});
To use the ViewBag content for the view I first need to get the data, to check the count of the columns and rows. Maybe this could be my problem, the timing.
Has anyone had a similar problem or can help me?
Using a (ASP.NET Core) Kendo spreadsheet, how to know if on the sheet are or not validation errors and what kind of if any.
I used this code to add validation
myCell.Validation(v => v
.ComparerType("custom")
.DataType("custom")
.From("R[0]C[0] > 0")
.Type("warning")
.ShowButton(true)
.AllowNulls(true)
.TitleTemplate("Alerte de validation")
.MessageTemplate("Attention, cette valeur est négative !"));
I used the upgrade wizard to download the latest version and I'm getting this error message on pages that have the components:
I filled in the G2 unable to trigger formula. Who can tell me
I am using @Html.Kendo().Spreadsheet() on a Razor page in a DotNet Core App. I want to Configure which options are available on the Toolbar and add a Custom one. I see from an older question from 2017, adding a Custom button was not supported back then. Has that changed?
Can someone point me to the appropriate documentation for that please.
I really have two questions: The first is as described above. I really have no need for the tool bar other than for entering cell comments, so I would like to know if there is a way to invoke that functionality with a double click. Also, I am replacing a Windows Desktop Application that does allow the users to double click to add comments so if I cannot do this in Kendo UI, it will be a behavior change for the users.
Secondly, can comment data be bound to the data source so that when I do a load or submit the database Comment field is updated along with all the other data?
I have a grid that contains a child detail spreadsheet. I am trying to duplicate some code I used from another Kendo Spreadsheet, but each spreadsheet and Export button needs to have a unique id. In the form I am using to export the Excel for the spreadsheet, I am using a Kendo Button to allow addition of the unique id (TplNum) from the parent grid. For some reason, the template is not valid when I add the Kendo Button. Any ideas?
I was going to use the Click event to determine the TplNum based on location of the button or the button id field in the Javascript callback, but thought that was giving me problems. Currently, I gave the buttons a class, "export_excel" and I'm trying to create a jQuery onClick function in my document.load, which is invoked based on class, rather than id.
$(document).ready(function () {}
}
<script id="campaign_template" type="text/kendo-tmpl">Good morning,
in a Telerik spreadsheet, is there a property to set the number of maximum decimal places of the value of each single cell? what default value has this property set?
What scope does it have? Is it set for each single cell or on the entire spreadsheet?
For example we have a cell that has value with 11 decimal places, how can we modify it (increase or decrease it)?
Kind regards,