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?