Closed Ruslan-F closed 8 years ago
I see you closed this issue, did you figure out what you needed? Some thoughts:
onClick
directly with a mock UI event.Don't know if this method looks ok to you, but this is how i solve it:
ProductTreemaNode.prototype.onClick = function (e) {
var newSelection;
newSelection = $(e.target).closest('.treema-search-result-row');
if (!newSelection.length) {
return ProductTreemaNode.__super__.onClick.call(this, e);
}
this.getSelectedResultEl().removeClass('treema-search-selected');
newSelection.addClass('treema-search-selected');
this.saveChanges();
if (!this.addingNewProperty()) {
return ProductTreemaNode.__super__.onEnterPressed.call(this, e);
}
return this.tryToAddNewChild(e, true);
};
Maybe it will help someone else.
Sorry to bother with howto questions in issues section, but couldn't find any other place to ask it. I'm using DatabaseSearchTreemaNode.extend(MyTreemaNode); to create a list of available values to add as a new array element. After click on one of search result rows - it's being added as a
<div class="treema-value treema-search treema-display">"element name"</div>
But to really push this element to array - user must activate this new row by mouse clicking on it (creates input element atm) and than press enter key to submit it. I tried simulate same events with $, but it ain't work. Is there any native way to skip this 'double-submit' and add new elements to array right after clicking on search result rows?