I have a Barcode that is within a partial view. If I do not include a width and height at the beginning I get an error when rendering.
@Html.Kendo().Barcode().Name("barcode-" + Guid.NewGuid().ToString()).Value(@Model.WidgetTagValue).Encoding(Model.barcode_symbology).Width(150).Height(150)
I have a resize event that tries to change it to fit the size of the parent div on page init and on window resize.
function setBarcodeSize() {
if ($('.k-barcode').length > 0) {
$('.k-barcode').each(function () {
var parentDivWidth = $(this).closest(".andon-widget-container").width() - 50;
var parentDivHeight = $(this).closest(".andon-widget-container").height() - $(this).closest(".andon-widget-container").find(".andon-widget-title").height();
$(this).css("width", $(this).width(parentDivWidth) + "px").css("height", $(this).height(parentDivHeight) + "px");
$(this).data("kendoBarcode").redraw();
});
}
}
The width and height of the k-barcode <div> are set appropriately but the size of the child <div> with the data-role="surface" remains at 150x150
Advice?
Hello,
I'm trying to put title on 2 lines but the layout is not so good. See attachment. This is the code used here :
steps[6] = 'Might well be expected at some time';steps[5] = 'Quite possi. could happen';steps[4] = 'Unusual but possible';steps[3] = 'Remotely possible';steps[2] = 'Conceivable but<br/>very unlik.';steps[1] = 'Pratically impossible';steps[0] = 'Choose value';AdapterLegendes("#NoProbabilite", steps);function AdapterLegendes(nomSlider, steps) { var slider = $(nomSlider).data("kendoSlider"); var largeTickItems = slider.wrapper.find(".k-tick-large"); $.each(largeTickItems, function (index) { var step = steps[index]; var children; $(this).attr("title", step).children().html(step); });}We have a project that is half ASP using RAD, and the other half is ASP MVC. On our local development boxes that project compiles and works fine, but when we publish it to production the icons do not appear. Initially, it was a CSS problem that wasn't skinning any of the MVC portion of the web site but we tweaked the path and now the Kendo controls are rendering fine, with the exception of the icons. I know that the icons reside in the sprite.png file, and I think I need to move a copy of the ~/Contents/kendo folder to another path so that the MVC portion of the project can find the icons, but so far I can figure out where to put it.
Any suggestions?
Attached is a screenshot of the folder structure of the project. The MVC portion of the project is in Areas/MvcArea.
Hi,
I have a grid with inline editing and a date field. Model:
[DataType(DataType.Date)]
public DateTime RelevantDate { get; set; }
Grid:
cols.Bound(p => p.RelevantDate).Format("{0:yyyy-MM-dd}").EditorTemplateName("DatePicker").Title("Date of change").Width(120);
The DatePicker template is in the Views\Shared\EditorTemplates folder.
My problem is that when I select a date in the grid and hit Submit the parameter model.RelevantDate in the controller method has the selected date and the current time i.e. 2016-04-01 08:19:41. What I would like to have is the date only: 2016-04-01 00:00:00. Is this possible?
Best regards,
Henrik
I have a 3 part question.
1) Can you set the value of a text in the same row, based on a selection from a dropdownlist. When a user chooses a Field, I would like to update the DisplayName column to a value based on the Field they chose.
2) How do you set the default value of a ClientTemplate checkbox to true
3) How do you set the default value of a textbox, I want to set the Ordering textbox to count + 1.
Following his my grid definition and relevant OnEdit function.
@(Html.Kendo().Grid<SOCKETWorx.Core.Data.GridViewProjection>() .Name("grid_ViewProjections") .Columns(columns => { columns.ForeignKey(m => m.FieldId, (System.Collections.IEnumerable)ViewData["AvailableFields"], "Id", "Value") .Title("Field").EditorTemplateName("FieldsEditor") .HeaderHtmlAttributes(new { style = "text-align:center" }) .Width(175); columns.Bound(m => m.Display) .Title("Display") .ClientTemplate("<input type='checkbox' #=Display ? checked='checked' : '' # />") .HeaderHtmlAttributes(new { style = "text-align:center" }) .Width(65).HtmlAttributes(new { style = "text-align: center" }); columns.Bound(m => m.DisplayName) .Title("Display Name") .HeaderHtmlAttributes(new { style = "text-align:center" }) .Width(250); columns.Bound(m => m.Ordering).Title("Order") .HeaderHtmlAttributes(new { style = "text-align:center" }) .Width(50) .HtmlAttributes(new { style = "text-align: center" }); columns.Command(command => { command.Destroy(); }).Width(100); }) .ToolBar(toolbar => { toolbar.Create().Text("Add"); toolbar.Save().SaveText("Save").CancelText("Cancel"); toolbar.Custom().Text("Custom View").Action("List", "Data", new { moduleId = Model.ModuleId, viewId = Model.Id }); }) .Editable(editable => editable.Mode(GridEditMode.InCell).CreateAt(GridInsertRowPosition.Bottom)) .Filterable() .Navigatable() .Sortable(sortable => { sortable.SortMode(GridSortMode.SingleColumn); }) .Scrollable() .Events(e => e.Edit("OnEdit")) .HtmlAttributes(new { style = "height:575px" }) .DataSource(dataSource => dataSource .Ajax() .Batch(true) .Model(model => model.Id(p => p.Id)) .ServerOperation(false) .Events(events => events.Error("OnError")) .Read(read => read.Action("ViewProjectons_Read", "ViewManager").Data("OnData")) .Create(create => create.Action("ViewProjectons_Create", "ViewManager").Data("OnData")) .Update(update => update.Action("ViewProjectons_Update", "ViewManager").Data("OnData")) .Destroy(destroy => destroy.Action("ViewProjectons_Destroy", "ViewManager")) ) )function OnEdit(e) { if (e.model.isNew()) { $.ajax({ type: "POST", url: '@Url.Action("GetGridViewColumnCount", "ViewManager")', contentType: "application/json; charset=utf-8", data: JSON.stringify({ viewId: @Model.Id }), dataType: "json", success: function (result) { if (result.status != "Success") { var order = e.container.find("input[name=Ordering]"); if (order) { order.val(result.message); } } }, error: function () { $(".validation-summary-valid").text(result.message); } }); e.container.find("input[name=Display]").prop('checked', true); } }
[DisplayName("Inactivate Date")]public DateTimeOffset? inactivateDate { get; set; }[DisplayName("Energizing Date")]public DateTimeOffset? energizingDate { get; set; }<div class="form-group"> @Html.LabelFor(model => model.energizingDate, new { @class = "control-label col-xs-2" }) <div class="col-xs-2"> @Html.EditorFor(model => model.energizingDate) @Html.ValidationMessageFor(model => model.energizingDate) </div> <div class="col-xs-3"> <div class="form-group"> @Html.LabelFor(model => model.activateDate, new { @class = "control-label col-xs-4" }) <div class="col-xs-7"> @Html.EditorFor(model => model.activateDate) @Html.ValidationMessageFor(model => model.activateDate) </div> </div> </div> <div class="col-xs-3"> <div class="form-group"> @Html.LabelFor(model => model.inactivateDate, new { @class = "control-label col-xs-4" }) <div class="col-xs-7"> @Html.EditorFor(model => model.inactivateDate) @Html.ValidationMessageFor(model => model.inactivateDate) </div> </div> </div></div>var x = dao.CONNECTIVITY_UNIT .Join(dao.OP_AREA_ORG, cu => cu.OP_AREA_CODE, oa => oa.OP_AREA_CODE, (cu, oa) => new { CONNECTIVITY_UNIT = cu, OP_AREA_ORG = oa }) .Where(w => w.CONNECTIVITY_UNIT.UNIT_TYPE.Equals("SUBSTATION")) .Where(w => w.CONNECTIVITY_UNIT.IS_ACTIVE_FLAG.ToUpper().Equals("Y")) .Where(w => w.CONNECTIVITY_UNIT.ABBR.ToUpper().Equals("BRA")) .Select(c => new SubstationVM { connectivityUnitID = c.CONNECTIVITY_UNIT.CONNECTIVITY_UNIT_ID, energizingDate = c.CONNECTIVITY_UNIT.ENERGIZING_DATE.Value.DateTime, activateDate = c.CONNECTIVITY_UNIT.ACTIVATE_DATE.Value.DateTime, //inactivateDate = c.CONNECTIVITY_UNIT.INACTIVATE_DATE.Value.DateTime, updateTime = c.CONNECTIVITY_UNIT.UPDATE_TMSTMP }) .OrderBy(o => o.substationABBR) .ToList();
Hello,
If I have a grid which fills more than the heigth of the screen, (if the grid doesn´t fill the whole height it works fine) for some reason when I click on the grids buttons it makes an annoying scroll to the top. It only happens in google chrome.
I attach a picture
Thank you


Hello,
I try to implement dynamic change of series in chart by javascript, but they just disappear.
Build chart ASP.NET MVC Razor:
<div id="chartWrapper"><br> @{<br> var x = new List<object>();<br> x.Add(new { Dt = DateTime.Parse("2017-01-01 01:00:00.000"), Value = 1 });<br> x.Add(new { Dt = DateTime.Parse("2017-01-01 02:00:00.000"), Value = 3 });<br> x.Add(new { Dt = DateTime.Parse("2017-01-01 03:00:00.000"), Value = 2 });<br> x.Add(new { Dt = DateTime.Parse("2017-01-01 04:00:00.000"), Value = 1 });<br> var y = new List<object>();<br> y.Add(new { Dt = DateTime.Parse("2017-01-01 01:00:00.000"), Value = 0 });<br> y.Add(new { Dt = DateTime.Parse("2017-01-01 02:00:00.000"), Value = 3 });<br> y.Add(new { Dt = DateTime.Parse("2017-01-01 02:10:00.000"), Value = 1 });<br> y.Add(new { Dt = DateTime.Parse("2017-01-01 02:20:00.000"), Value = 3 });<br> y.Add(new { Dt = DateTime.Parse("2017-01-01 02:30:00.000"), Value = 2 });<br> y.Add(new { Dt = DateTime.Parse("2017-01-01 03:00:00.000"), Value = 3 });<br> y.Add(new { Dt = DateTime.Parse("2017-01-01 04:00:00.000"), Value = 1 });<br> var z = new List<object>();<br> z.Add(new { Dt = DateTime.Parse("2017-01-01 01:00:00.000"), Value = 6 });<br> z.Add(new { Dt = DateTime.Parse("2017-01-01 02:00:00.000"), Value = 1 });<br> z.Add(new { Dt = DateTime.Parse("2017-01-01 02:05:00.000"), Value = 2 });<br> z.Add(new { Dt = DateTime.Parse("2017-01-01 02:10:00.000"), Value = 3 });<br> z.Add(new { Dt = DateTime.Parse("2017-01-01 02:15:00.000"), Value = 4 });<br> z.Add(new { Dt = DateTime.Parse("2017-01-01 02:20:00.000"), Value = 5 });<br> z.Add(new { Dt = DateTime.Parse("2017-01-01 02:25:00.000"), Value = 4 });<br> z.Add(new { Dt = DateTime.Parse("2017-01-01 02:30:00.000"), Value = 3 });<br> z.Add(new { Dt = DateTime.Parse("2017-01-01 03:00:00.000"), Value = 2 });<br> z.Add(new { Dt = DateTime.Parse("2017-01-01 04:00:00.000"), Value = 1 });<br> }<br> <div class="demo-section k-content wide"><br> @(Html.Kendo().Chart()<br> .Name("chartTest")<br> .HtmlAttributes(new { style = "height: 550px; width: 700px; z-index: 0;" })<br> .Title("test")<br> .Legend(legend => legend.Position(ChartLegendPosition.Top))<br> .SeriesDefaults(seriesDefaults => seriesDefaults.Column().Stack(true))<br> .PlotArea(area => area.Background("#f0f0f0").Opacity(0.1))<br> .Series(series =><br> {<br> series.Line(x).CategoryField("Dt").Field("Value").Name("X").Color("#F00").DashType(ChartDashType.Solid).MissingValues(ChartLineMissingValues.Interpolate).Markers(m => m.Visible(false));<br> series.Line(y).CategoryField("Dt").Field("Value").Name("Y").Color("#0F0").DashType(ChartDashType.Solid).MissingValues(ChartLineMissingValues.Interpolate).Markers(m => m.Visible(false));<br> series.Line(z).CategoryField("Dt").Field("Value").Name("Z").Color("#00F").DashType(ChartDashType.Solid).MissingValues(ChartLineMissingValues.Interpolate).Markers(m => m.Visible(false));<br> })<br> .CategoryAxis(axis => axis<br> .Date()<br> .BaseUnit(ChartAxisBaseUnit.Minutes)<br> .Labels(labels => labels.DateFormats(formats => formats.Hours("HH:mm")).Rotation(-45).Step(60))<br> .MinorGridLines(lines => lines.Visible(false))<br> .MinorTicks(t => t.Step(60).Visible(false))<br> .MajorGridLines(lines => lines.Step(60).Visible(true))<br> .MajorTicks(t => t.Step(60).Visible(true))<br> .Crosshair(c => c.Visible(true))<br> .PlotBands(bands =><br> {<br> bands.Add().From(DateTime.Parse("2017-01-01 01:00:00.000")).To(DateTime.Parse("2017-01-01 02:08:00.000")).Color("#b0e1fc").Opacity(0.2);<br> })<br> )<br> .ValueAxis(axis => axis<br> .Numeric()<br> .Line(line => line.Visible(true))<br> .MinorGridLines(lines => lines.Visible(false))<br> .MinorTicks(t => t.Step(2).Visible(false))<br> .MajorGridLines(lines => lines.Step(1).Visible(true))<br> .MajorTicks(t => t.Step(1).Visible(true))<br> )<br> )<br> <br> </div><br> </div>Javascrip that erase series:
var chart = $("#chartTest").data("kendoChart");<br>chart.refresh();<br>Is there a json/jscript function to select the filtered data when using the spreadsheet. I'm trying to find a way to limit the data that has to get serialized when I'm doing updates. Here's my Save function. I'm looking for a way to potentially replace the spreadsheetData with the filtered data set instead of the entire bound data set.
function Save_onClick() { var staticNotification = $("#staticNotification").data("kendoNotification"); staticNotification.show(" Updating data..."); var dataSource = $("#spreadsheet").data("kendoSpreadsheet").activeSheet().dataSource; var spreadsheetData = dataSource._data; if (spreadsheetData) { $.ajax({ type: "POST", url: '@Url.Action("Grid_Update", "Spreadsheet")', contentType: "application/json; charset=utf-8", data: JSON.stringify({ datum: spreadsheetData, moduleId: @Model.TheModule.Id }), dataType: "json", success: function (result) { if (result.status == "Success") { $(".validation-summary-valid").text(result.message); staticNotification.hide(); } else { } } }); } }
Thanks,
Neil
