Our blazing fast Grid component built with pure JavaScript


Post by ubaid khan »

Consider the following relation:

Contact:
   id
   name
EntityContact
   id
   contactId

Notice in the following Contact Model I have a custom setter for name field and whenver I need to set value to this field I would expect it to be done through my custom name setter function.

class Contact extends Model {
    static get fields() {
       return [
         { name: "name", dataSource: "name" },
       ];
    }

    set name(val) {
       // performing some custom logic
       this.set("name", val);
    }

    get name(val) {
       return this.get("name");
    }
}

I've following relation defined in EntityContact model class

class EntityContact extends Model {
    static relations = {
        contactRecord: {
          foreignKey: "contactId",
          foreignStore: "contactStore",
          relatedCollectionName: "entityContacts",
        }
     }
   
   // ... other fields definition not mentioned
}

The problem lies here when I try to set the nested field using the setter function of model expecting it that I would call my custom name setter function but it doesn't.

entityContactStore.first.set("contactRecord.name", "XYZ")

Post by ghulam.ghous »

Hi Ubaid,

Thanks for the detailed report. I have created a ticket here to investigate and fix this issue. You can subscribe to it to keep track of updates: https://github.com/bryntum/support/issues/8890

Regards,
Ghous


Post Reply