Telerik Forums
Kendo UI for Angular Forum
0 answers
316 views

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

Bob
Top achievements
Rank 3
Iron
Iron
Veteran
 updated question on 22 Sep 2022
0 answers
163 views

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

Materovich
Top achievements
Rank 1
Veteran
 asked on 22 Sep 2022
0 answers
126 views

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

Vedad
Top achievements
Rank 3
Bronze
Bronze
Iron
 updated question on 22 Sep 2022
1 answer
126 views
I'm trying to set up a chart whose data is bound to an observable. Even using the exact example on observables provided on the data binding page, it fails to compile with the error "Type 'number[] | null' is not assignable to type 'any[]'." How can I resolve this?
Megan
Top achievements
Rank 1
Iron
Iron
 answered on 22 Sep 2022
0 answers
122 views
Is there any docs or sample app in NodeJs or so for a back end of what the File Upload component expects to implement some of these features.
David
Top achievements
Rank 1
 asked on 21 Sep 2022
0 answers
85 views

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>

Bartek
Top achievements
Rank 1
 asked on 21 Sep 2022
1 answer
241 views

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.

        <kendo-formfield [orientation]="'horizontal'">
          <kendo-label [for]="searchWithoutRouteCheckbox" text="wyszukaj bez trasy"></kendo-label>
          <input type="checkbox" #searchWithoutRouteCheckbox class="search-without-route-type"
            [formControlName]="formNames.searchWithoutRoute" [value]="formModel.searchWithoutRoute" kendoCheckBox
            [disabled]="areControlsDisabled" />
          <app-form-error [controlName]="formNames.searchWithoutRoute" [form]="form"></app-form-error>
        </kendo-formfield>

 

  /**
   * If form controls should be disabled
   * @type {boolean}
   * @public
   */
  public areControlsDisabled: boolean = true;

 

  /**
   * Fired when railway objects combobox value is changed
   * @param {RailwayObject} value railway object item
   * @public
   */
  public railwayObjectsValueChange(value: RailwayObject): void {
    if (value) {
      this.areControlsDisabled = false;
      this.isSearchButtonDisabled = false;
      this.isClearButtonDisabled = true;
      return;
    }
    this.areControlsDisabled = true;
    this.isSearchButtonDisabled = true;
    this.isClearButtonDisabled = true;
  }

 

 

Martin Bechev
Telerik team
 answered on 20 Sep 2022
1 answer
106 views

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

Martin Bechev
Telerik team
 answered on 20 Sep 2022
0 answers
849 views

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

  1. Content-Disposition:
    inline; filename=34455.pdf
  2. Content-Length:
    73847
  3. Content-Type:
    application/pdf

Please suggest/help if we are doing anything wrong here?


Vijay
Top achievements
Rank 1
 asked on 18 Sep 2022
1 answer
182 views

Trying out the new fluent theme, most components are looking good but the menu looks very condensed, even in the examples.


https://www.telerik.com/kendo-angular-ui/components/menus/menu/

 

 

Can this be fixed?

 

 

Martin Bechev
Telerik team
 answered on 16 Sep 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?