Telerik Forums
KendoReact Forum
1 answer
240 views

I'm sorry for not being good at English.

Using the KendoUI React demo, I've encountered a weird issue with the bar charts. I gave each chart an interval of 3, 5, or 10 seconds, intending that each one refreshes by 3 seconds, 5 seconds, and 10 seconds. But when I turn on the dev mode and confirm it, the charts refresh together every second the other chart does.

FYI, This code is to be child components into a map of the parent component, so I cannot divide that component by each page. I hope to get a good answer to this situation.

 

pages/disk-index


import { Chart, ChartTooltip, ChartSeries, ChartSeriesItem } from '@progress/kendo-react-charts';
import { useState, useEffect, useRef } from 'react';
import Disk from './disk';

export default function Home() {
    const intervalDisk = useRef(null);

    const diskData1 = [{ categoryField: 'root', value: 40, color: 'blue' }];

    const [diskData1State, setDiskData1State] = useState(diskData1);

    const isClient = typeof window === 'object';

    useEffect(() => {
        if (isClient) {
            intervalDisk.current = setInterval(() => {
                diskData1[0].value = Math.floor(Math.random() * 100);
                // console.log(new Date() + ', ' + diskData1[0].value);
                setDiskData1State(JSON.parse(JSON.stringify(diskData1)));
            }, 10000);
            return () => clearInterval(intervalDisk.current);
        }
    }, []);

    return (
        <>
            <Disk diskId="1" interval="3000" />
            <Disk diskId="2" interval="5000" />
            <div id="diskDataId2">
                <Chart
                    style={{
                        width: '90%',
                        height: '85%',
                        position: 'center center',
                    }}
                >
                    <ChartTooltip />
                    <ChartSeries>
                        <ChartSeriesItem
                            type="bar"
                            stack={{
                                type: 'normal',
                            }}
                            gap={2}
                            spacing={0.35}
                            categoryField="categoryField"
                            colorField="color"
                            data={diskData1}
                            tooltip={true}
                        />
                    </ChartSeries>
                </Chart>
            </div>
        </>
    );
}

pages/disk


import { Chart, ChartTooltip, ChartSeries, ChartSeriesItem } from '@progress/kendo-react-charts';
import { useState, useEffect, useRef } from 'react';

export default function Disk(props) {
    console.log(JSON.stringify(props));

    const intervalDisk = useRef(null);

    const diskData1 = [{ categoryField: 'root', value: 40, color: 'red' }];

    const [diskData1State, setDiskData1State] = useState(diskData1);

    useEffect(() => {
        intervalDisk.current = setInterval(() => {
            diskData1[0].value = Math.floor(Math.random() * 100);
            // console.log(new Date() + ', ' + diskData1[0].value);
            setDiskData1State(JSON.parse(JSON.stringify(diskData1)));
        }, Number(props.interval));
        return () => clearInterval(intervalDisk.current);
    }, [diskData1State]);

    return (
        <>
            <div id={'diskData' + props.diskId}>
                <Chart
                    style={{
                        width: '90%',
                        height: '85%',
                        position: 'center center',
                    }}
                >
                    <ChartTooltip />
  

Konstantin Dikov
Telerik team
 answered on 21 Jun 2022
1 answer
75 views

Is this a bug? https://www.telerik.com/kendo-react-ui/components/grid/rows/row-reordering/#toc-kendoreact-dragdrop

If you try to drag item 4 between 1 and 2, it takes position #1 (not as expected, it should take position #2). This only happens when dragging between #1 and #2 - if you drag above #1, the row becomes #1 (as expected).

Vessy
Telerik team
 answered on 16 Jun 2022
1 answer
1.4K+ views

Hello all,

I'm trying to implement a functionality which relies on Kendo Grid (React + Typescript) with selectable rows (with checkbox) as in the second example in the docs:

https://www.telerik.com/kendo-react-ui/components/grid/selection/

Is there any way (based on that example) to make the rows conditionally disabled? Say I click one of the rows which does two things:

  • sets some filtering state (not a problem),
  • based on this state I make it impossible to select another row. They should become disabled, and greyed out (struggling to achieve this)

What I tried to do was removing pointerEvents by setting them to none, but this one unfortunately also removed the tooltip that should be attached to each row explaining why it's been disabled.

I also tried to override Grid's onRowClick event by:

onRowClick={()=>{}}
but this didn't prevent the row from being selectable.

 

Any help much appreciated,

Krzysztof

Konstantin Dikov
Telerik team
 answered on 16 Jun 2022
1 answer
143 views

Hi all,

 

I'm importing Kendo's Editor into a fresh react project and styling with default theme. There is a large white space area at the top of the editor content area that I cannot get rid of. Any idea what's causing this?

App created using npx create-react-app.

Editor: 5.3.0

Kendo-theme-default: 5.5.0


import '@progress/kendo-theme-default/dist/all.css';
import { Editor, EditorTools } from "@progress/kendo-react-editor";
const {
  Bold,
  Italic,
  Underline,
  AlignLeft,
  AlignRight,
  AlignCenter,
  Indent,
  Outdent,
  OrderedList,
  UnorderedList,
  Undo,
  Redo,
  Link,
  Unlink,
} = EditorTools;

const content = `<p>The KendoReact Editor allows your users to edit HTML in a familiar, user-friendly way.<br />The Editor provides the core HTML editing engine, which includes text formatting, hyperlinks, and lists. The component <strong>outputs identical HTML</strong> across all major browsers, follows accessibility standards, and provides API for content manipulation.</p><p>Features include:</p><ul><li><p>Text formatting</p></li><li><p>Bulleted and numbered lists</p></li><li><p>Hyperlinks</p></li><li><p>Cross-browser support</p></li><li><p>Identical HTML output across browsers</p></li></ul>`;

const App = () => {
  return (
    <Editor
      tools={[
        [Bold, Italic, Underline],
        [Undo, Redo],
        [Link, Unlink],
        [AlignLeft, AlignCenter, AlignRight],
        [OrderedList, UnorderedList, Indent, Outdent],
      ]}
      contentStyle={{
        height: 320,
      }}
      defaultContent={content}
    />
  );
};

export default App;

 

Vessy
Telerik team
 answered on 15 Jun 2022
1 answer
54 views

I have a function where I need to merge variables in to a document preferably in docx format and then place a PDF document as a background in to the document.  Can PDF Processing do this?

 

Thank you.

Konstantin Dikov
Telerik team
 answered on 13 Jun 2022
1 answer
167 views

Hi, I tried to use a RadioButton inside a telerik Form component but it seems not working.

I started from the example on

https://www.telerik.com/kendo-react-ui/components/form/get-started/

And I added a checkbox (it works fine) and 3 radiobutton, but it is not clear for me how use them: they doesn't load initial values and not falls on the submit json.

This is my example:

https://stackblitz.com/edit/react-oxhaws?file=src%2FApp.js

 

Are there some example on this case?

Vessy
Telerik team
 answered on 10 Jun 2022
1 answer
70 views

how to make a chart line with two different color conditions?

please give me sample code instructions

Vessy
Telerik team
 answered on 09 Jun 2022
1 answer
67 views

Currently, I have an issue when using Scheduler component. I try for the example in Scheduler Document and I realize that SchedulerItem will not show when data props of scheduler have the same start and end DateTime example like this screenshot

But in my case, I want to show when both start and end are equal. I've tried to find a solution with the document but I can't. Do you have any comments on my situation? Thank you so much

Konstantin Dikov
Telerik team
 answered on 09 Jun 2022
1 answer
109 views
Is the conversational UI something that can be used to implement a chat program between users of an app?  I do not need the chat bot functionality, at least not now...
Vessy
Telerik team
 answered on 09 Jun 2022
1 answer
98 views

Hi

I have a scenario to add onChange for custom Grid Cell the issue is that When I try to do that the cell loses focus on
any update of the grid parent component state

when I added useEffect to track the component lifecycle, the component unmounts and mounts with every change.
"The cell that loses focus here is the Discount 
cell"

Running Example stackblitz
Code


import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { Grid, GridColumn } from '@progress/kendo-react-grid';
import { NumericTextBox } from '@progress/kendo-react-inputs';

const products = [
  {
    ProductID: 1,
    ProductName: 'Chai',
    Price: 18.0,
    Discount: 0,
  },
  {
    ProductID: 2,
    ProductName: 'Chang',
    Price: 19.0,
    Discount: 0,
  },
];

const CustomCell = (props) => {
  React.useEffect(() => {
    console.log('componet mount');
  }, []);

  return (
    <td style={{ padding: '1rem', textAlign: 'center' }}>
      <NumericTextBox
        onChange={(e) => props.onChange(e, props)}
        style={{ width: '100px' }}
        value={props.dataItem[props.field]}
      />
    </td>
  );
};

const App = () => {
  const [data, setData] = React.useState(products);

  const handleDiscountChange = (e, cellProps) => {
    setData((_data) => {
      return _data.map((item) => {
        if (item.ProductName === cellProps.dataItem.ProductName) {
          item.Discount = e.value || 0;
          item.Price -= item.Discount;
        }
        return item;
      });
    });
  };

  return (
    <>
      <Grid data={data} title={'title'} editField="inEdit">
        <GridColumn field="ProductName" title="Product Name" />
        <GridColumn
          field="Discount"
          cell={(props) => {
            return <CustomCell {...props} onChange={handleDiscountChange} />;
          }}
        />
        <GridColumn field="Price" title="Price" editor="numeric" />
      </Grid>
    </>
  );
};

ReactDOM.render(<App />, document.querySelector('my-app'));



Konstantin Dikov
Telerik team
 answered on 08 Jun 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Henri
Top achievements
Rank 2
Iron
Iron
Iron
SUNIL
Top achievements
Rank 2
Iron
Iron
Iron
David
Top achievements
Rank 1
Jackson
Top achievements
Rank 1
Iron
Iron
Tim
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Henri
Top achievements
Rank 2
Iron
Iron
Iron
SUNIL
Top achievements
Rank 2
Iron
Iron
Iron
David
Top achievements
Rank 1
Jackson
Top achievements
Rank 1
Iron
Iron
Tim
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?