Load more comments and Chat widget

Hello,
I would like to use the Loading comments on demand with the Chat widget.

I try to make a custom view like this :


class CustomMessages extends chat.views["messages"] {
	config() {

		const ui = super.config();
		ui.rows[1].mode = "chat";
		ui.rows[1].onClick  = {
			"webix_comments_more": () => {console.log('clic more');}
		};
		return ui;
	}
}

The chat mode works correctly

ui.rows[1].mode = "chat";

But the on Click doesn’t…

	ui.rows[1].onClick  = {
			"webix_comments_more": () => {console.log('clic more');}
		};

Any idea how I can override the onClick on the “More comments” button ?

Thanks in advance,

Good day, @Martin
There is “comments more” source code . As you can see, it is a part of a Comments widget. The Comments consists of several parts, including a List where you can find the onClick event.
However, the simplest way to achieve your goal is to catch the click on this button through the list’s onDataRequest event (it is called in the source code). If you return false there, then nothing will be executed further.
There is an example: Code Snippet .
By the way, as for the onClick method, you could override it not in config() but in init() after the Comments widged has been initialized like here : Code Snippet .
Get the Comments widget - get the list - override the method.
Also, for more major changes in the list, I would suggest you create a custom component and change there what you wish in the $configList method (it is not private). Then, you could replace the original component with the custom one. Check this example too, please : Code Snippet .

1 Like

Thanks for your anwer, very usefull :slight_smile: