Under the export options for charts, there's an example of how to fit a chart to the size of your paper. Part of this example includes some kind of conversion function and a rectangle constant.
function mm(val: number): number {
return val * 2.8347;
}
const PAGE_RECT = new geometry.Rect([0, 0], [mm(210 - 20), mm(297 - 20)]);
However, there is absolutely no explanation for these numbers. Am I converting to or from millimeters, and what's the other unit? Why am I doing this? Where are these 210 and 297 numbers coming from in the page rectangle? I can see that the minus 20 is accounting for the 1cm margin set in the PDF below, but other than that I have no idea what the origin of these numbers is.
Can someone please translate these magic numbers? Telerik, can you please add comments to the example code explaining?
I am using jQuery editor in both ASPX application and Angular application. As part of this editor, I am using an extension for the table editing. This extension works great in the ASPX app, but in Angular I get error that "kendoDialog is not a function". What do I need to do in Angular to get this working? All other features of the jQuery editor are working.
declare var kendo: any;
declare var $: any;
export class CellBorderWizardPlugin {
public static init() {
const cellBorderCommand = kendo.ui.editor.TableWizardCommand.extend({
exec() {
const cmd = this;
const range = (cmd.range = cmd.lockRange());
cmd.selectedCells = cmd._selectedCells(range);
cmd.dialog = $('#cellPropsDialog').data('kendoDialog');
cmd.colorPickerAlreadyLoaded = cmd.dialog ? 'yes' : 'no';
cmd.dialog = $('#cellPropsDialog')
.kendoDialog({
title: 'Cell Border Wizard',
buttonLayout: 'normal',
actions: [
{
text: 'Apply',
primary: true,
action: $.proxy(cmd.applyChanges, cmd),
},
{ text: 'Close' },
],
})
.data('kendoDialog');
if (cmd.colorPickerAlreadyLoaded === 'no') {
cmd.dialog.element.find('#borderColor').kendoColorPicker({
clearButton: true,
buttons: false,
opacity: false,
});
cmd.dialog.element.find('#borderSize').kendoNumericTextBox({
value: 1,
min: 0,
step: 1,
format: 'n0',
restrictDecimals: true,
});
cmd.dialog.element.find('#border').kendoDropDownList({
autoWidth: true,
});
cmd.dialog.element.find('#borderStyle').kendoDropDownList({
autoWidth: true,
});
}
cmd.dialog.open();
},
applyChanges() {
for (let i = 0; i < this.selectedCells.length; i++) {
const selectedCell = this.selectedCells[i];
const dialog = this.dialog;
const border = 'border' + dialog.element.find('#border').val();
const borderSize = dialog.element.find('#borderSize').val();
const borderStyle = dialog.element.find('#borderStyle').val();
const borderColor = dialog.element
.find('#borderColor')
.data('kendoColorPicker')
.value();
if (border) {
selectedCell.style[border + 'Color'] = borderColor
? borderColor
: '';
if (borderSize) {
selectedCell.style[border + 'Width'] = borderSize + 'px';
}
if (borderStyle) {
selectedCell.style[border + 'Style'] = borderStyle;
}
}
kendo.ui.editor.Command.fn.releaseRange.call(this, this.range);
}
return false;
},
});
const cellBorderTool = kendo.ui.editor.TableModificationTool.extend({
command(options: any) {
return new cellBorderCommand(options);
},
});
kendo.ui.editor.EditorUtils.registerTool(
'tableCellProperties',
new cellBorderTool({
command: cellBorderCommand,
template: new kendo.ui.editor.ToolTemplate({
template: kendo.ui.editor.EditorUtils.buttonTemplate,
title: 'Cell Border Wizard',
}),
}),
);
}
}
<div id="cellPropsDialog" style="display: none;">
<div style="width: 250px;">
<div class="k-edit-label">Cell Side</div>
<div class="k-edit-field">
<select id="border">
<option value="Top">top</option>
<option value="Right">right</option>
<option value="Bottom">bottom</option>
<option value="Left">left</option>
</select>
</div>
<div class="k-edit-label">Size</div>
<div class="k-edit-field">
<input type="number" id="borderSize" style="width: 70px;" />
</div>
<div class="k-edit-label">Color</div>
<div class="k-edit-field">
<input id="borderColor" value="#000000" />
</div>
<div class="k-edit-label">Style</div>
<div class="k-edit-field">
<select id="borderStyle">
<option value="solid">solid</option>
<option value="dotted">dotted</option>
<option value="dashed">dashed</option>
<option value="double">double</option>
<option value="groove">groove</option>
<option value="ridge">ridge</option>
<option value="inset">inset</option>
<option value="outset">outset</option>
<option value="inherit">inherit</option>
<option value="none">none</option>
<option value="hidden">hidden</option>
</select>
</div>
</div>
</div>
Thanks,
Bob
Hi, I'd like to add an icon to all the headers of my grid. This icon must be placed just next to the filter icon (on the right of the filter button):
I was trying this using the header template but only can modify the left of the filter (the title area).
I'll appreciate any help with this.
Thanks in advance
Hi,
I implemented kendo grid for angular for the small POC I am making.
I have standard CRUD grid without much logic - so I need to be able to add data, change it and delete it.
I was following example from the page and I have the grid, bound to remote data (observable), however after I click ADD and finish adding data in the row, click Save, row disappears.
Example provided in documentation which reads data completely again is not a good case for me, because service can take sec or two to finish and I don't need to reload all the data.
Same goes with remove action (only data is not removed).
I have four separate service methods for CRUD.
Am I missing some property or configuration (or have a logic flaw) to tell the grid to preserve row after adding it, and to remove it on remove?
Thank you
Vedad
Hello,
I would like to implement exactly the same behaviour as in this kendo-multiselect for jQuery https://docs.telerik.com/kendo-ui/knowledge-base/listview-multipleselection-drag-to-select-draggable
How can I do it in angular ??
Here is my multiselect.
To be honest I dont know how to approach this. As you an see I have
kendoMultiSelectTagTemplate
And I would like to reorder this partictular element actually(in my case this is string with one checkbox that is readonly)
[checkboxes]="{ checkOnClick: false, enabled: true }"
formControlName="selectedLanguages"
(valueChange)="onSelectedLanguageChange($event)"
[autoClose]="false"
textField="Language"
valueField="Value"
[data]="availableLanguages">
<ng-template kendoMultiSelectItemTemplate let-dataItem>
<span> {{ dataItem.Language }}</span>
<label class="use-channel-lang-label" [for]="useChannel"> Use channel language: </label>
<input
type="checkbox"
(change)="onUseChannelLangValueChange($event, dataItem)"
#useChannel
[checked]="dataItem.UseChannelLanguage"
kendoTooltip="Use channel language"
kendoCheckBox />
</ng-template>
<ng-template kendoMultiSelectTagTemplate let-dataItem>
<span>{{ dataItem.Language }}</span>
<kendo-sortable [kendoSortableBinding]="languages"></kendo-sortable>
<input type="checkbox" [checked]="dataItem.UseChannelLanguage" [disabled]="true" kendoCheckBox />
</ng-template>
</kendo-multiselect>
Hello,
I have a form in component. One of controls is checkbox. I'm setting initially its state to disabled, but it's not working, it's always enabled.
Hi,
In our application we use translation by providing LOCALE_ID value in app.module. Everything works well. It's just that we found some component elements' translation incorrect for our usecase. I mean specifically month names in kendo-datepicker, which are in incorrect grammatical form for polish version. I have not found keys for the mentioned. Is there a way to customize the translation of element's texts besides those seen in the custom messages component? I'll be grateful for the detailed approach.
Kind regards
Hi,
In my organization's project we are using telerik controls and for one requirement we were calling saveAS method of angular by passing proxy URL and getting PDF content from .net API. It was displaying PDF in new tab and working fine with all browser.
We followed below approach.
https://www.telerik.com/kendo-angular-ui/components/file-saver/server-proxy/
Now , we are upgrading our apps for latest angular and .net core 6 version . During upgrade we noticed that we have to change the .net API method something like below as HttpResponseMessage is not working in .net 6.
Following changes we made for API method.
[HttpPost]
[Route("savepdfdocument")]
public FileContentResult SavePDF([FromForm]FileData file)
{
var data = Convert.FromBase64String(file.Base64);
Response.Headers.Add("Content-Disposition", "inline; ; filename=" + file.FileName);
Response.Headers.Add("Transfer-Encoding", "identity");
return File(data, file.ContentType); //file.ContentType ="application/pdf"
}
Now if we are using "Content-Disposition" as "attachement " with file name then all browser download the PDF file correctly.
Issue: With Response.Headers.Add("Content-Disposition", "inline; ; filename=" + file.FileName);
All browser display the PDF correctly in new tab, no issue in display.
But once we try to download the PDF file from browser PDF viewer then following issue occurred in chrome and IE edge(in FF it is working).
1- In download file name it taking as action method name without .pdf, in our case 'savepdfdocument'
2- Download fails with message Network Error(while not network call happening)
We checked headers , and it have all necessary value like below
Please suggest/help if we are doing anything wrong here?