Telerik Forums
KendoReact Forum
1 answer
84 views
I would like to protect against multiple form submission in KendoReact Form. I would like to disable the submit button after clicking it. I'm missing some kind of field like isSubmitting to indicate that submission is in progress. The allowSubmit field does not change to false after submitting the form.
Filip
Telerik team
 answered on 27 Feb 2025
1 answer
62 views

I have added a button in the Grid's toolbar to clear all filters. However, when the button is clicked, the filter object is set to null, but the filter values in the UI are not reset. This creates a discrepancy between the displayed filter values and the actual filtered data.

Steps to Reproduce:

Add a button in the Grid's toolbar to clear all filters.

Apply some filters to the grid.

Click the clear filter button.

Observe that the filter values in the UI do not reset, even though the filter object is set to null.

Expected Result:
Clicking the clear filter button should reset both the filter object and the displayed filter values in the UI.

Actual Result:
The filter object is set to null, but the displayed filter values in the UI remain unchanged.

Solution Attempted:
I have placed a Button component within the GridToolbar and set the filter object of the DataState stored in the state to null within its click event. However, this does not reset the UI filter values.

Demo code: https://stackblitz.com/edit/react-e4qxtaef?file=app%2Fapp.jsx

Document reference: https://www.telerik.com/kendo-react-ui/components/knowledge-base/grid-add-clear-filters-button

Additional Information:

The issue persists regardless of the theme used.

No error messages are displayed in the console.

Request:
Please investigate and provide a solution to ensure that the clear filter button resets both the filter object and the displayed filter values in the UI.

Yanko
Telerik team
 answered on 26 Feb 2025
1 answer
49 views

Hello!

I am working with two separate components. The first component displays data in a Kendo Grid, and the second component displays the same data in a Kendo Chart.

I have implemented a function that saves the index of the row when it is clicked (currentDatasetRow). The goal is to display the tooltip for that index in the chart whenever the index changes, and also to deactivate the tooltip when clicking the same row again.

I have tried a few things using the chartInstance from the ref, but I am a bit lost in how to get it to work correctly. I would really appreciate any guidance on how to implement this.

This is my component: 

import {
  Chart,
  ChartCategoryAxis,
  ChartCategoryAxisItem,
  ChartLegend,
  ChartSeries,
  ChartSeriesItem
} from '@progress/kendo-react-charts'
import 'hammerjs'
import React, { useEffect, useRef, useState } from 'react'
import { format } from 'date-fns'
import { useSelector } from 'react-redux'
function ChartComponent ({ dataProps }) {
  const currentDatasetRow = useSelector(state => state.monitorMenu.currentDatasetRow)
  const chartRef = useRef(null)
  const [tooltipIndex, setTooltipIndex] = useState(null)

  useEffect(() => {
    setTooltipIndex(currentDatasetRow)
  }, [currentDatasetRow])

  const lineTooltipRender = (props) => {
    const value = props.point.value
    const formattedValue = value.toLocaleString(undefined, { minimumFractionDigits: 0, maximumFractionDigits: 4 })
    const formattedDate = format(new Date(props.point.category), 'yyyy-MM-dd HH:mm:ss')

    return (
      <div>
        Date: {formattedDate}
        <br />
        Value: {formattedValue}
      </div>
    )
  }

  return (
    <div style={{ height: '50vh', width: '100%', position: 'relative' }}>
      {(dataProps && dataProps.length > 0)
        ? (
        <Chart
          ref={chartRef}
          style={{ height: '100%', width: '100%' }}
          pannable={true}
          zoomable={true}
          transitions={false}
          className='custom-chart'
        >
          <ChartLegend position="top" />
          <ChartCategoryAxis>
            <ChartCategoryAxisItem maxDivisions={10} visible={false} axisCrossingValue={-1000} />
            <ChartCategoryAxisItem maxDivisions={10} />
          </ChartCategoryAxis>
          <ChartSeries>
             {dataProps.map((item, index) => {
               const parameter = item[0].parameter

               return (
                <ChartSeriesItem
                  key={index}
                  type="line"
                  data={item}
                  field="value"
                  categoryField="category"
                  name={parameter}
                  style="smooth"
                  width={parameter.includes('Anom.') ? 0 : 2}
                  tooltip={{ visible: true, render: lineTooltipRender }}
                  visible={true}
                />
               )
             })}
          </ChartSeries>
        </Chart>
          )
        : (
        <div style={{ height: '50vh', width: '100%' }}></div>
          )}
    </div>
  )
}

const MemoizedChartComponent = React.memo(ChartComponent)
export default MemoizedChartComponent

 

Yanko
Telerik team
 answered on 25 Feb 2025
1 answer
45 views
Hello,
We are deleloping a project management module for our enterprise application and require a Gantt chart component to display hierarchical tasks data in tabular and timeline formats.
We use React and found KendoReact Gantt component as a sutable ready-to-use solution to meet most of our application's requirements.
However, we’ve encountered some limitations which are very importand for us that currently prevent us from adopting this component:

1) Virtualization Support for Large Datasets.
We need do display large amout of tasks simultaneously (up to 10000) so virtualization is a crucial feature for us for performance reasons. But for now it is not possible to enable it via Gantt component public API  (If I am not mistaken, Gantt uses GanttTreeList component internally very similar to TreeList with Virtual Scrolling support out of the box).
So the question is why virtualization is not supported by React Gantt component ? Is it possipbe to enable it as it seems as a very usefull and popular feature for enterprise applications?

2) Drag-and-Drop editing is also a very usefull and required functionality in our case. (Move/resize tasks along the timeline, adjust completion percentage, dependencies editing).
We noticed these features are (maybe partially) available in the Kendo Gantt components for (at least) jQuery and Angular.
Are there plans to introduce similar functionality in the KendoReact Gantt component? If so, could you share a timeline for implementation?

We’d greatly appreciate your insights on these points, as they are critical to our evaluation process.
Yanko
Telerik team
 answered on 24 Feb 2025
0 answers
48 views

Hello,

I am using the latest version of Kendo React Grid with multi-row selection and checkboxes. However, I encountered an issue where clicking on a cell (e.g., in the Product Name column) resets the previously selected checkboxes.

Steps to Reproduce:

  1. Click on multiple checkboxes to select rows.
  2. Click on a cell in the Product Name column.
  3. The previous checkbox selections are reset.

Expected Behavior:

  • I only want the checkboxes to control row selection.
  • Clicking on other cells (e.g., Product Name) should not affect the selected checkboxes.

Current Behavior:

  • Clicking a non-checkbox cell resets the checkbox selection.

Demo & Documentation:

<Grid data={products} style={{
      height: '400px'
    }} dataItemKey={DATA_ITEM_KEY} selectable={{
      enabled: true,
      drag: false,
      cell: false,
      mode: 'multiple'
    }} select={select} onSelectionChange={onSelectionChange} onHeaderSelectionChange={onHeaderSelectionChange}>
                <Column columnType="checkbox" />
                <Column field="ProductName" title="Product Name" width="300px" />
                <Column field="UnitsInStock" title="Units In Stock" />
                <Column field="UnitsOnOrder" title="Units On Order" />
                <Column field="ReorderLevel" title="Reorder Level" />
            </Grid>

Question:

How can I prevent clicking on other cells from affecting the checkbox selection? I want rows to be selected only via checkboxes, not by clicking other cells.

Thanks in advance!

Best regards,
Trustin


Trustin
Top achievements
Rank 1
Iron
 updated question on 22 Feb 2025
1 answer
46 views

Hi Team,

I am writing to inquire about modifying the default behaviour of the Kendo UI Menu component. The sub-menu items are displayed when hovering over the parent menu item. However, I require the sub-menu items to be visible only when the parent menu item is clicked.

Desired Behavior:

  • Sub-menu items should remain hidden by default.
  • Clicking on the parent menu item should expand the sub-menu and display the child items.
  • Clicking on another parent menu item should collapse the previously expanded sub-menu and expand the new one.

Implementation Challenges:

I have explored the Kendo UI documentation and API, but I am unable to find a direct configuration option to achieve this desired behaviour.

Could you please provide guidance on how to modify the Kendo UI Menu component to display sub-menu items only on click of the parent menu item?

Please let me know if you require any further information or if there are any examples available that demonstrate this functionality.

Reference URL - https://stackblitz.com/edit/react-zugkrezk?file=app%2Fapp.jsx,app%2Fapp.css

Thank you for your time and assistance.
Mahesh

Vessy
Telerik team
 answered on 21 Feb 2025
1 answer
49 views

Description: When using MUI Autocomplete inside the KendoReact GridColumnMenuFilter, clicking on the autocomplete input triggers the Popper component outside the GridColumnMenuFilter wrapper. However, when selecting an option from the Popper, the outside click event of the GridColumnMenuFilter is triggered, causing the filter menu to close unexpectedly.

Steps to Reproduce:

  1. Open the provided demo link.

  2. Click on the MUI Autocomplete input inside the GridColumnMenuFilter.

  3. Observe that the Popper appears outside the filter menu.

  4. Click on an option in the Popper.

  5. Notice that the GridColumnMenuFilter closes immediately after selecting an option.

Expected Behavior: Selecting an option from the MUI Autocomplete Popper should not trigger the outside click event of the GridColumnMenuFilter, preventing it from closing unintentionally.

Actual Behavior: The GridColumnMenuFilter closes when selecting an option from the Popper.



import * as React from 'react';
import { AutoComplete } from '@progress/kendo-react-dropdowns';
import TextField from '@material-ui/core/TextField';
import Autocomplete from '@material-ui/lab/Autocomplete';

const data = [
  { title: 'The Shawshank Redemption', year: 1994 },
  { title: 'The Godfather', year: 1972 },
  { title: 'The Godfather: Part II', year: 1974 },
  { title: 'The Dark Knight', year: 2008 },
  { title: '12 Angry Men', year: 1957 },
  { title: "Schindler's List", year: 1993 },
  { title: 'Pulp Fiction', year: 1994 },
  { title: 'The Lord of the Rings: The Return of the King', year: 2003 },
  { title: 'The Good, the Bad and the Ugly', year: 1966 },
  { title: 'Fight Club', year: 1999 },
];

export const CustomFilterUI = (props) => {
  const onChange = (event) => {
    const value = event.value === 'null' ? null : event.value === 'true';
    const { firstFilterProps } = props;
    firstFilterProps.onChange({
      value,
      operator: 'eq',
      syntheticEvent: event.syntheticEvent,
    });
  };

  const { firstFilterProps } = props;
  const value = firstFilterProps.value;

  return (
    <div>
      <h3>MUI Autocomplete</h3>
      <Autocomplete
        id="combo-box-demo"
        options={data}
        getOptionLabel={(option) => option.title}
        style={{ width: 300 }}
        renderInput={(params) => (
          <TextField {...params} label="Combo box" variant="outlined" />
        )}
        onChange={onChange}
        disablePortal
      />
      <h3>Kendo Autocomplete</h3>
      <AutoComplete data={data} textField="title" onChange={onChange} />
    </div>
  );
};

Demo Link: StackBlitz Demo

Additional Notes:

  • The issue might be due to event propagation from the MUI Popper component.

  • A potential fix could involve preventing the GridColumnMenuFilter from closing when clicking inside the Popper.

  • Seeking guidance on how to prevent this behavior while maintaining correct filtering functionality.

Looking forward to your support and suggestions. Thank you!

Yanko
Telerik team
 answered on 20 Feb 2025
1 answer
41 views
I’m working on a custom filter UI for a KendoReact Grid. While the KendoReact DropDownList component works as expected, the native <select> tag in the same component does not respond to clicks or changes. There are no visible CSS issues, and the onChange event handler is not firing. I’ve tried debugging with console.log and refs, but the issue persists.

Expected Behavior:

The native <select> tag should open when clicked.

The onChange event should fire when a new option is selected.

Actual Behavior:

The <select> tag does not open when clicked.

The onChange event handler is not triggered.

Steps to Reproduce:

Create a custom filter UI component for a KendoReact Grid.

Add a native <select> tag to the component.

Attach an onChange event handler to the <select> tag.

Try clicking the <select> tag or changing its value.

Code Example: https://stackblitz.com/edit/react-nwl6un8y?file=app%2Fapp.jsx
Yanko
Telerik team
 answered on 20 Feb 2025
0 answers
32 views

We have a grid that has expand collapse functionality on the first column of the grid.  I would like to make the header of the column a button or place an icon that could be clicked to toggle the expand/collapse functionality.

Channing
Top achievements
Rank 1
 asked on 19 Feb 2025
1 answer
40 views

I’m using a Kendo form and rendering it dynamically. I’m facing an issue with the upload component validation. For example, when creating a new record, a validation error shows up if the file is not uploaded. However, after the data is saved and when I edit the record, if any other fields are changed, the validation error appears for those fields. What I want is to skip the validation for the upload component while editing, so the form can be submitted without it, but the validation should still be enforced during creation.

I am using these type off code

 [{
    id: 'clusterCode',
    name: 'clusterCode',
    label: 'Cluster Code',
    required: true,
    type: 'text',
    fieldType: 'Input',
    validator: requiredValidator,
  },
  {
    id: 'clusterName',
    name: 'clusterName',
    label: 'Cluster Name',
    type: 'text',
    fieldType: 'Input',
    required: true,
    validator: requiredValidator,
  },]

 

these type data can be use and these my form code 

/** @format */
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import {
  Field,
  FieldRenderProps,
  FieldValidatorType,
  Form as OkForm,
} from '@progress/kendo-react-form';
import { Button } from '@progress/kendo-react-buttons';
import { LABEL_CANCEL, LABEL_STAR, LABEL_SUBMIT } from '@constants/Common';
import { MultiSelect } from '@progress/kendo-react-dropdowns';
import { FormComponent } from './FormComponent';
import './form.css';
type FormFieldInit = {
  restrictions?: any;
  hint?: unknown;
  note?: unknown;
  readonly?: unknown;
  id?: string;
  type: string;
  dataItemKey?: string;
  defaultItem?: string;
  textField?: unknown;
  required?: unknown;
  data?: unknown;
  options?: string;
  fieldType?: string;
  name: string;
  label?: string;
  validator?: FieldValidatorType;
  colSpan?: number;
  rowSpan?: number;
  rows?: number;
  requiredHint?: boolean;
};
interface FormProps {
  formField: FormFieldInit[];
  editValue: { [key: string]: unknown };
  formOnchange: (
    event: React.ChangeEvent<
      HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement
    >
  ) => void;
  formaStyle: React.CSSProperties;
  handleSubmit: (data: { [key: string]: unknown }) => void;
  formRef: React.RefObject<HTMLFormElement>;
}
const CustomField = ({ label }: { label: string }) => (
  <div className='form-group'>
    <label>
      <span>{label}</span>
      <span style={{ color: 'red' }}> {LABEL_STAR}</span>
    </label>
  </div>
);
function Form({
  formField,
  editValue,
  formOnchange,
  formaStyle,
  handleSubmit,
  formRef,
}: FormProps) {
  const [initialValues, setInitialValues] = useState<Object>({});
  const {
    FormDropDownList,
    FormInput,
    FormDateTimePicker,
    FormCheckbox,
    FormTextArea,
    FormDatePicker,
    FormMaskedInputWithCountryCode,
    FormUpload,
  } = FormComponent();
  const fieldComponents: {
    [key: string]: React.ComponentType<FieldRenderProps>;
  } = {
    Input: FormInput,
    TextArea: FormTextArea,
    Dropdown: FormDropDownList,
    MultiSelector: MultiSelect,
    DatePicker: FormDatePicker,
    Checkbox: FormCheckbox,
    Upload: FormUpload,
  };
  useEffect(() => {
    const generatedValues = formField.reduce(
      (acc, field) => ({
        ...acc,
        [field.name]: editValue?.[field.name] || '',
      }),
      {}
    );
    setInitialValues(generatedValues);
  }, [editValue, formField]);
  return (
    <OkForm
      ref={formRef}
      initialValues={initialValues}
      onSubmit={handleSubmit}
      key={JSON.stringify(initialValues)}
      render={(formRenderProps) => (
        <div>
          <div
            style={{
              ...formaStyle,
            }}
          >
            {formField.map((items, index) => {
              const FieldComponent = fieldComponents[items.fieldType];
              return (
                <div
                  style={{
                    gridColumn: items.colSpan
                      ? `span ${items.colSpan}`
                      : 'span 1',
                  }}
                  key={index}
                >
                  <Field
                    id={items.id}
                    name={items.name}
                    component={FieldComponent}
                    label={
                      items.required === true ? (
                        <CustomField label={items.label} />
                      ) : (
                        items.label
                      )
                    }
                    validator={items.validator}
                    data={items.data}
                    required={items.required}
                    textField={items.textField}
                    defaultItem={items.defaultItem}
                    filterable={true}
                    dataItemKey={items.dataItemKey}
                    onChange={formOnchange}
                    readonly={items.readonly}
                    props={{
                      ...(items.fieldType === 'Dropdown' ||
                      items.fieldType === 'MultiSelector' ||
                      items.fieldType === 'DatePicker' ||
                      items.fieldType === 'Checkbox'
                        ? { data: items.options }
                        : {}),
                    }}
                    note={items.note}
                    customHint={items.hint}
                    type={items.type}
                    restrictions={items.restrictions}
                    rows={items.rows}
                    requiredHint={items.requiredHint}
                  />
                </div>
              );
            })}
          </div>
          <div
            style={{
              display: 'grid',
              gridTemplateColumns: 'repeat(4,1fr)',
              gap: '25px',
              flexWrap: 'wrap',
              marginTop: 20,
              maxWidth: '456px',
            }}
          >
            <Button
              onClick={() => {
                formRef.current.resetForm();
                setInitialValues({});
              }}
            >
              {LABEL_CANCEL}
            </Button>
            <Button
              themeColor='primary'
              disabled={!formRenderProps.allowSubmit}
              onClick={formRenderProps.onSubmit}
            >
              {LABEL_SUBMIT}
            </Button>
          </div>
        </div>
      )}
    />
  );
}
export default Form;
Yanko
Telerik team
 answered on 19 Feb 2025
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?