Error with kendo react wrapper on stackblitz

1 Answer 58 Views
Wrappers for React
Alex
Top achievements
Rank 1
Iron
Iron
Alex asked on 13 Dec 2021, 04:05 PM

Hello,

I'm trying to create a stackblitz with a kendo-react-wrapper example showing a MultiSelect, but I get the following error:

Error in /turbo_modules/@progress/kendo-base-component-react-wrapper@2021.3.1112/dist/npm/index.js (47:32)
Cannot read properties of undefined (reading 'call')

Here is the code and the link to stackblitz: https://stackblitz.com/edit/react-ts-9tttzc?file=index.tsx

Thank you.

Kind regards

import { MultiSelect } from '@progress/kendo-dropdowns-react-wrapper';
import * as React from 'react';
import { useRef, useState } from 'react';
import { render } from 'react-dom';
import './style.css';

export const App = (props) => {
  const [value, setValue] = useState();

  const ds1 = [
    { id: '1', descr: 'test1' },
    { id: '2', descr: 'test2' },
    { id: '3', descr: 'test3' },
    { id: '4', descr: 'test4' },
  ];

  const listRef = useRef();

  const changeHandler = (e) => setValue(e.sender.value());

  const virtual = {
    itemHeight: 26,
    valueMapper: (options) => {
      const indices = [];
      const values = Array.isArray(options.value)
        ? options.value
        : [options.value];

      let ref = listRef.current as any;
      let widget;

      if (ref) {
        widget = ref.widgetInstance;
      }

      if (values && widget) {
        let index = 0;
        widget.dataSource.data().forEach((x) => {
          if (values.indxOf(x[props.dataValueField])) {
            indices.push(index);
          }

          index += 1;
        });
      }

      options.success(indices);
    },
  };

  return (
    <div>
      <p>
        <MultiSelect
          ref={listRef}
          dataSource={ds1}
          dataValueField={'id'}
          enable={true}
          dataTextField={'descr'}
          value={value}
          change={changeHandler}
          filter={'contains'}
          valuePrimitive={true}
          autoWidth={true}
          virtual={virtual}
        />
      </p>
    </div>
  );
};

render(<App />, document.getElementById('root'));


1 Answer, 1 is accepted

Sort by
0
Alex
Top achievements
Rank 1
Iron
Iron
answered on 13 Dec 2021, 04:28 PM

Hi, I've found that I was missing:

import '@progress/kendo-ui';

Thank you.

Regards

Stefan
Telerik team
commented on 14 Dec 2021, 06:08 AM

Hello, 

Yes, indeed, the wrapper packages require the @progress/kendo-ui package as they are using the Kendo UI components underneath. 

Also, we recommend using the KendoReact components when possible as they are built explicitly for React:

https://www.telerik.com/kendo-react-ui/components/dropdowns/multiselect/

We made the wrappers until the full React components were ready, and they were recently deprecated:

https://www.npmjs.com/package/@progress/kendo-dropdowns-react-wrapper

Tags
Wrappers for React
Asked by
Alex
Top achievements
Rank 1
Iron
Iron
Answers by
Alex
Top achievements
Rank 1
Iron
Iron
Share this question
or