Could any one help.
I have liveData table with several fields that I need to use to create unic identifier and keep it in another;
Are there any way to do it automatically? Maybe any macros that I can set like default value in Id field, that will get values from specific fields and store in Id field;
I found in vue DisplayerXObjectProperty place where to update value of editing field and automatically update entered value to add macros.
But I can’t found how to get values of other fields:
Is it possible to use this.logic or this.data.data ?
can’t found examples in code how to use it.
Place where I add customization:
methods: {
/**
* Process the edit form content and send it to be saved.
*/
applyEdit() {
const documentName = this.logic.getEntryId(this.entry);
if (!documentName) {
new XWiki.widgets.Notification(this.$t('livedata.displayer.xObjectProperty.missingDocumentName.errorMessage'),
'error');
} else {
$(document).trigger('xwiki:actions:beforeSave');
const fields = $(this.$refs.xObjectPropertyEdit).find(':input').serializeArray();
const className = this.data.query.source.className;
const data = {};
fields.forEach(field => {
var newName = field.name;
if (newName.startsWith(className)) {
// Remove the class name and the object number in order to keep only the property name.
newName = newName.substring(className.length);
newName = newName.replace(/^_\d+_/, '');
}
// Aggregates the fields with the same name in an array. If a field is found only once it is stored alone.
if (data[newName]) {
if (!Array.isArray(data[newName])) {
data[newName] = [data[newName]];
}
data[newName].push(field.value);
} else {
data[newName] = field.value;
}
});
this.logic.getEditBus().save(this.entry, this.propertyId, data);
}
},