jquery-datalink icon indicating copy to clipboard operation
jquery-datalink copied to clipboard

unlink doesn't clean up the added jquery data member

Open wshaver opened this issue 13 years ago • 3 comments

After calling something like: $("input", row).link(rowData);

The rowData object will get a member like jQuery15109948021615406466 which points to an object. I believe this object is used to manage the link.

Calling unlink or removing the input from the dom does NOT remove the member. $("input", row).unlink(rowData); // jQuery15109948021615406466 still exists

I'm running into issues with getting some data via json, binding to a form, changing the data, then attempting to send it back to the client but failing because of these extra members.

wshaver avatar Jun 22 '11 22:06 wshaver

I can confirm this issue exists as well. +1

aw-emberex avatar Jun 22 '11 22:06 aw-emberex

This can be done manually as follows:

jQuery.removeData( rowData, undefined, true );

wshaver avatar Jun 22 '11 22:06 wshaver

I created a function to retrieve the data object and remove the expando. This is non-destructive and leaves the original backing object intact.

        getFieldData: function() {
            var fieldData = {};
            this.each(function() {
                fieldData = $.extend({}, this);
                delete fieldData[$.expando];
            });
            return fieldData;
        }

D1g1talEntr0py avatar Sep 25 '11 12:09 D1g1talEntr0py