Colleagues, I train and try to create your first ingredient for Design Studio. Faced with the problem of malfunction onkeyup event, this event is triggered through time and overwrites the previous character in the input. Here is the code:
Component.js
sap.designstudio.sdk.Component.subclass("com.sap.sample.editkey.EditKey", function() {
var that = this;
this.init = function() {
this.tagInput = $('<input id="aps_edit" type="text">');
this.$().append($(this.tagInput));
$("#aps_edit").keypress(function() {
that.firePropertiesChanged(["text"]);
that.fireEvent("onkeypress");
});
};
this.text = function(value) {
if (value === undefined) {
return $("#aps_edit").val();
}
else {
$("#aps_edit").val(value);
return this;
}
};
});
contribution.ztl
class com.sap.sample.editkey.EditKey extends Component {
String getValue() {*
return this.text;
*}
void setValue(/* New Value */ String newValue) {*
this.text = newValue;
*}
}
If you remove that.firePropertiesChanged ([ "text"]), the symbol is no longer overwritten, but also variable text no longer be updated.
Help me to understand.