OdinaSpb / jstree

Automatically exported from code.google.com/p/jstree
0 stars 0 forks source link

jstree remove then get parent #1000

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

i have a jstree with the remove.jstree binding

and i want to get the immediate parent of the item i removed but i always get -1
what am i doing wrong?

    .bind("remove.jstree", function (e, data) {
                data.rslt.obj.each(function () {
                alert(this.id);
                var parent=data.inst._get_parent(data.rslt.obj);
                alert(parent.find('a').first().text()); 

                $.ajax({
                    async: false,
                    type: 'POST',
                    url: siteRoot + "Ajax/AjaxItemOperations.aspx",
                    data: {
                        "operation": "remove_node",
                        "id": this.id,
                        "parentId": 2
                    },
                    success: function (r) {
                        if (!r.status) {
                            data.inst.refresh();
                        }
                    }
                });
            });
        })

Original issue reported on code.google.com by bobeica....@gmail.com on 15 Nov 2012 at 3:34

GoogleCodeExporter commented 9 years ago
Did you ever solve this?
I want to get the parent of a node just removed, but am having the exact same 
issue.

Original comment by andrew....@gmail.com on 4 Nov 2013 at 3:05