If I use the the odata parameter $exapnd to get a Primary record with its associated n-1 how do I map/model this in the source dataAdapter or grid?
Example if Contact is the Primary entity and ContactType is the n-1 and using $expand I get a result like
"__ENTITIES":[{"__KEY":"196","__STAMP":20,"ID":196,"firstName":"ab","middleName":"ddd","lastName":"eee",
"ContactType":{"__KEY":"3","__STAMP":2,"ID":3,"name":"Work","contactCollection":{"__deferred":{"uri":"/rest/ContactType(3)/contactCollection?$expand=contactCollection"}}},"addressCollection":{"__deferred":{"uri":"/rest/Contact(196)/addressCollection?$expand=addressCollection"}}}
Then I define my datafields like so, How do I define ContactType if I want to display ContactType.name in the grid.
myDataModel = [{
name : "__KEY"
}, {
name : "__STAMP"
}, {
name : "ID"
}, {
name : "firstName"
}, {
name : "middleName"
}, {
name : "lastName"
}]
Is there a way when defining your datafields model to define related entities?
I tried just adding ContactType.name to the grid column but that didn’t work.
columns : [{
text : 'ID',
datafield : 'ID'
}, {
text : 'First Name',
datafield : 'firstName'
}, {
text : 'Middle Name',
datafield : 'middleName'
}, {
text : 'Last Name',
datafield : 'lastName'
}, {
text : 'Contact Type',
datafield : 'ContactType.name'
}
Not sure the best approach for handling complex data, any help is appreciated