Skip to content

Commit 8079ba5

Browse files
committed
add november KB articles
1 parent 3285721 commit 8079ba5

File tree

5 files changed

+209
-0
lines changed

5 files changed

+209
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: Scroll KendoReact Conversational UI to the bottom automatically
3+
description: An example on how to make the Conversational UI scroll to the bottom automatically
4+
type: how-to
5+
page_title: Scroll to the bottom of each message automatically - KendoReact Conversational UI
6+
slug: conversational-ui-scroll-to-bottom-automatically
7+
tags: conversational-ui, scroll, scroll to bottom, automatically, scroll automatically
8+
ticketid: 1615928
9+
res_type: kb
10+
category: knowledge-base
11+
---
12+
13+
## Environment
14+
15+
<table>
16+
<tbody>
17+
<tr>
18+
<td>Product Version</td>
19+
<td>6.1.0</td>
20+
</tr>
21+
<tr>
22+
<td>Product</td>
23+
<td>Progress® KendoReact</td>
24+
</tr>
25+
</tbody>
26+
</table>
27+
28+
## Description
29+
30+
When the user sends the first message, the Conversational UI scrolls to the bottom automatically, however in the next messages it does not.
31+
32+
## Solution
33+
34+
This can be achieved by adjusting the scrollTop of the `.k-message-list` container on the [onMessageSend](https://www.telerik.com/kendo-react-ui/components/conversationalui/api/ChatProps/#toc-onmessagesend) event:
35+
36+
{% meta id:index height:900 %}
37+
{% embed_file conversational-ui/conversational-ui-scroll-to-bottom/main.jsx preview %}
38+
{% endmeta %}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import * as React from "react";
2+
import * as ReactDOM from "react-dom";
3+
import { Chat } from "@progress/kendo-react-conversational-ui";
4+
const user = {
5+
id: 1,
6+
avatarUrl:
7+
"https://demos.telerik.com/kendo-ui/content/web/Customers/RICSU.jpg",
8+
avatarAltText: "KendoReact Conversational UI RICSU",
9+
};
10+
const bot = {
11+
id: 0,
12+
};
13+
const initialMessages = [
14+
{
15+
author: bot,
16+
suggestedActions: [
17+
{
18+
type: "reply",
19+
value: "Neat!",
20+
},
21+
],
22+
timestamp: new Date(),
23+
text: "Hello, this is a demo bot. I don't do much, but I can count symbols!",
24+
},
25+
];
26+
const App = () => {
27+
const [messages, setMessages] = React.useState(initialMessages);
28+
const addNewMessage = (event) => {
29+
let botResponse = Object.assign({}, event.message);
30+
botResponse.text = countReplayLength(event.message.text);
31+
botResponse.author = bot;
32+
setMessages([...messages, event.message]);
33+
setTimeout(() => {
34+
setMessages((oldMessages) => [...oldMessages, botResponse]);
35+
const messageList = document.querySelector(".k-message-list");
36+
if (messageList) {
37+
messageList.scrollTop = messageList.scrollHeight;
38+
}
39+
}, 1000);
40+
};
41+
const countReplayLength = (question) => {
42+
let length = question.length;
43+
let answer = question + " contains exactly " + length + " symbols.";
44+
return answer;
45+
};
46+
return (
47+
<div>
48+
<Chat
49+
user={user}
50+
messages={messages}
51+
onMessageSend={addNewMessage}
52+
placeholder={"Type a message..."}
53+
width={400}
54+
/>
55+
</div>
56+
);
57+
};
58+
ReactDOM.render(<App />, document.querySelector("my-app"));
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import React, { useState, useEffect } from "react";
2+
import ReactDOM from "react-dom";
3+
import { MultiSelect } from "@progress/kendo-react-dropdowns";
4+
import { filterBy } from "@progress/kendo-data-query";
5+
import countries from "./countries";
6+
7+
const App = () => {
8+
const [data, setData] = useState(countries.slice());
9+
const [value, setValue] = useState("");
10+
11+
const onFilterChange = (event) => {
12+
setData(filterBy(countries.slice(), event.filter));
13+
setValue(event.filter.value);
14+
};
15+
16+
useEffect(() => {
17+
const input = document.getElementsByClassName("k-input-inner");
18+
input[0].setAttribute("maxlength", 2);
19+
}, []);
20+
21+
return (
22+
<div>
23+
<div>Select country:</div>
24+
<MultiSelect
25+
data={data}
26+
filterable={true}
27+
onFilterChange={onFilterChange}
28+
style={{
29+
width: "300px",
30+
}}
31+
placeholder="e.g. Austria"
32+
/>
33+
</div>
34+
);
35+
};
36+
37+
ReactDOM.render(<App />, document.querySelector("my-app"));
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: Color the MultiSelect tags conditionally
3+
description: An example on how to color the tags conditionally
4+
type: how-to
5+
page_title: Color the MultiSelect tags based on a condition - KendoReact MultiSelect
6+
slug: multi-select-color-tags-conditionally
7+
tags: multi-select, multi-select, color, tags,
8+
ticketid: 1599602
9+
res_type: kb
10+
category: knowledge-base
11+
---
12+
13+
## Environment
14+
15+
<table>
16+
<tbody>
17+
<tr>
18+
<td>Product Version</td>
19+
<td>6.1.0</td>
20+
</tr>
21+
<tr>
22+
<td>Product</td>
23+
<td>Progress® KendoReact</td>
24+
</tr>
25+
</tbody>
26+
</table>
27+
28+
## Description
29+
30+
How to color all the selected tags based on a condition?
31+
32+
## Solution
33+
34+
This can be achieved by customizing the tags via the [tagRender](https://www.telerik.com/kendo-react-ui/components/dropdowns/api/MultiSelectProps/#toc-tagrender/):
35+
36+
{% meta id:index height:900 %}
37+
{% embed_file multiselect/multiselect-color-tags/main.jsx preview %}
38+
{% endmeta %}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: Limit the MultiSelect input to two characters
3+
description: An example on how to restrict the user to enter only two characters
4+
type: how-to
5+
page_title: Limit MultiSelect to accept only two characters - KendoReact MultiSelect
6+
slug: multi-select-limit-input
7+
tags: multi-select, limit input, maxLength
8+
ticketid: 1599602
9+
res_type: kb
10+
category: knowledge-base
11+
---
12+
13+
## Environment
14+
15+
<table>
16+
<tbody>
17+
<tr>
18+
<td>Product Version</td>
19+
<td>6.1.0</td>
20+
</tr>
21+
<tr>
22+
<td>Product</td>
23+
<td>Progress® KendoReact</td>
24+
</tr>
25+
</tbody>
26+
</table>
27+
28+
## Description
29+
30+
How to Limit the user to be able to enter only two characters in the MultiSelect?
31+
32+
## Solution
33+
34+
This can be achieved by limiting the input on the [onFilterChange](https://www.telerik.com/kendo-react-ui/components/dropdowns/api/MultiSelectProps/#toc-onfilterchange) event:
35+
36+
{% meta id:index height:900 %}
37+
{% embed_file multiselect/multiselect-limit-input/main.jsx preview %}
38+
{% endmeta %}

0 commit comments

Comments
 (0)