OnAfterEdit Comments

Hello,

is there a way to call a function after a comment has been edited?

I would like to send an request to the server to update the comment.

Thanks in advance.

Regards
Gorden

Comments

  • After a little bit of further research I found a solutions that worked for me.

    I add a "onStoreUpdate" event to the internal datastore in the onAfterLoad function from my comments view.

    onAfterLoad() {
    $$("comments").$exportView().data.attachEvent("onStoreUpdated", (id,
    update, operation) => {
    console.log("updated");
    console.log(webix.stringify(update));
    });
    },

    If there is a better solution, please let me know.

    Regards
    Gorden

  • Hello @GoKap,
    You are right, you can get the new comment text by listening to the onStoreUpdated event of the inner list of Comments :

    $$("$comments1").queryView("list").data.attachEvent("onStoreUpdated", function(id, data, oper){
        if (oper == "update") console.log(data.text);
    });
    

    Please check the snippet:
    https://snippet.webix.com/z84e6smk

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion