0
I have an object that can be updated from a drag-drop interaction with a grid-stack object (https://github.com/troolee/gridstack.js#questions-and-Answers). Depending on the object update (change of position) an attribute of it is modified. How can I capture the modifications of this specific object. Taking into account only the change of attribute.
I can capture the object if the user clicks on it with the event "click".
$("div.container-fluid").on("click", "div.grid div#view", function() {
console.log(this);
});
The object to be captured is in the DOM:
<div data-gs-x="0" data-gs-y="0" data-gs-width="4" data-gs-height="4" class="grid-stack-item ui-draggable ui-resizable ui-resizable-autohide"> </div>
The attributes that are modified are: data-Gs-y="0" data-Gs-width="4". These attributes are changed by a drag drop interaction of the grid-stack component.
A few questions: Is there an event that captures the click and drag via mouse? Or does gridStack own? (I found nothing in the documentation). Or monitor changes (of attributes) in DOM objects automatically?
.prop('minhaProp');
- if you explain better by putting together an example I can explain better too.– Sergio
hi Sergio, the problem is not to take the property of an object. But, to know if the object has suffered some modification.
– Bruno Nascimento
Explain the question further. As it is I could not realize that you want to know when the object was modified and I do not know yet what kind of modification and what action/function modifies it.
– Sergio
Is it a DOM object or is it a q object you create via code? which element is a div?
– Guerra
It is an object of the GIFT:
<div data-gs-x="0" data-gs-y="0" data-gs-width="4" data-gs-height="4" class="grid-stack-item ui-draggable ui-resizable ui-resizable-autohide"> </div>
. It can change attributesdata-gs-y="0" data-gs-width="4"
if user click and drag.– Bruno Nascimento
@Brunonascimento, follows a
JSFiddle
with a Mutationnote that should solve your problem: Jsfiddle– Tobias Mesquita