Load Comment

Hi, by referring the example given: https://snippet.webix.com/ww82u48f
we should be able to control the load comment. How we control the number of comment to be load actually? Let’s say, I want to load the comment week by week, how the data structure should be look alike?

Thanks

Hello @laicp,

we should be able to control the load comment. How we control the number of comment to be load actually?

You can control the number of not yet loaded comments by returning the more parameter from the server, which indicates the number of records that should be loaded next. Please refer to the article regarding loading commnets on demand, it contains the required server response format and some additional information regarding the feature (i.e. loading latest comments).

You can also check this out via the sample you’ve provided (https://snippet.webix.com/ww82u48f), and check the Network tab in your DevTools. Note the response and the request format as well.

Let’s say, I want to load the comment week by week, how the data structure should be look alike?

I would suspect that this sort of logic should be handled on the server, and the more parameter value should be dynamically changed according to the number of records that match the specific criteria.

Hi @Dzmitry … Thanks, I got it now.

Just another question. Can we add a spin (loading) when we click Load More?
Else the screen may hang while waiting the old comments loaded to the front end

Hey again @laicp,

Just another question. Can we add a spin (loading) when we click Load More?

Sure, you will need to extend the existing component with the ProgressBar mixin to able to show the progress of a certain action.

For example, here is how it would look like with the comments widget: https://snippet.webix.com/vl4xt0d4.

As you can see, when you click the “Load more” button, a progress icon appears. Please note that in most cases you will need to manully call the showProgress() method for the bar/icon to appear. You can read more about the ProgressBar mixin in this article.