Chat component

Get help with using Metro 4 components
Post Reply
gakyuz
Posts: 4
Joined: Sat Mar 23, 2019 3:27 pm
Status: Offline

Chat component

Post by gakyuz » Tue Mar 26, 2019 12:48 pm

Is there any explantion of chat component ? I could not find in guide.

User avatar
olton
Site Admin
Posts: 225
Joined: Mon Apr 09, 2018 6:19 pm
Location: Kiev, Ukraine
Status: Offline

Post by olton » Tue Mar 26, 2019 1:00 pm

in 4.2.40

gakyuz
Posts: 4
Joined: Sat Mar 23, 2019 3:27 pm
Status: Offline

Post by gakyuz » Tue Mar 26, 2019 1:14 pm

:)

ProGGG
Posts: 7
Joined: Tue Jan 15, 2019 2:01 pm
Status: Offline

Post by ProGGG » Wed Jul 24, 2019 2:07 pm

Добрый день!

Пишу следующее:

Code: Select all

<div
  data-role="chat"
  data-width="100%"
  data-height="400"
  data-on-send="send_message"
  data-on-message="on_message"
  data-on-chat-create="onChatCreate"
  id="chat"
></div>
.......

Code: Select all

<script>
function send_message(msg) {

}

function on_message(msg) {

}

function onChatCreate()
{

}</script>
Ругается только на onChatCreate:

Code: Select all

ReferenceError: onChatCreate is not defined		metro.js line 3445 > Function:3:1
Что я делаю не так?

User avatar
olton
Site Admin
Posts: 225
Joined: Mon Apr 09, 2018 6:19 pm
Location: Kiev, Ukraine
Status: Offline

Post by olton » Wed Jul 24, 2019 2:48 pm

функция onChatCreate должна быть определена ДО объявления компонента

ProGGG
Posts: 7
Joined: Tue Jan 15, 2019 2:01 pm
Status: Offline

Post by ProGGG » Thu Jul 25, 2019 12:59 pm

Спасибо!

Подскажите, пожалуйста, как программно создавать chat из div-a, с указанием его параметров.

User avatar
olton
Site Admin
Posts: 225
Joined: Mon Apr 09, 2018 6:19 pm
Location: Kiev, Ukraine
Status: Offline

Post by olton » Thu Jul 25, 2019 2:33 pm

Code: Select all

<div id="chat"></div>

<script>
$("#chat").chat({...});
</script>

Post Reply