I have the below class and its properties initialized within the constructor. I have an onchange function which sets property 'currentFilter' and i want this value to remain in the object However when the set function is triggered it resets the object and the value of 'currentFilter' is lost. How can i retain the values of the properties and prevent it from getting initialized when they have values.
class Filters
{
constructor()
{
this.isShow = false;
this.currentFilter = '';
}
async loadFilters()
{
const query = `?$select=*&$filter=_new_table_value eq ${window.parent.Xrm.Page.data.entity.getId().replace(/[{}]/g, "")}&$orderby=ice_name asc`;
this.Filters = await window.parent.Xrm.WebApi.retrieveMultipleRecords('ice_filterstable', query);
return this;
}
}
<script>
export default {
data() {
return {
filters : {};
};
},
methods: {,
set () {
const filters = new Filters();
this.filters = await filters.loadFilters();
},
changeFilter: (itemId, itemText) =>
{
this.filters.isShow = true;
this.filters.currentFilter = itemId;
},
}