Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I found a solution that works for some of my questions.</p> <p>As a bypass to my first question, I find that mapping of more than two levels is problematic, so I added a hasOne relationship. I don't think it's a good solution, but have no others, would love a comment about this.</p> <pre><code>{name: 'jmeterOverrideThreads', mapping: 'jmeterOptions.overrideOptions.threads', type: 'number'}, {name: 'jmeterOverrideRampUpTime', mapping: 'jmeterOptions.overrideOptions.rampUpTime', type: 'number'}, {name: 'jmeterOverrideIterations', mapping: 'jmeterOptions.overrideOptions.iterations', type: 'number'}, {name: 'jmeterOverrideDuration', mapping: 'jmeterOptions.overrideOptions.duration', type: 'number'}, </code></pre> <p>from the model, becomes:</p> <pre><code>hasOne: [ {model: 'OverrideOptions', associationKey: 'jmeterOptions', reader: {root: 'overrideOptions'}} ], // and: Ext.define('OverrideOptions', { extend: 'Ext.data.Model', fields: [ {name: 'jmeterOverrideThreads', mapping: 'threads', type: 'number'}, {name: 'jmeterOverrideRampUpTime', mapping: 'rampUpTime', type: 'number'}, {name: 'jmeterOverrideIterations', mapping: 'iterations', type: 'number'}, {name: 'jmeterOverrideDuration', mapping: 'duration', type: 'number'} ] }); </code></pre> <p>As for my second question about the associations not working: In my model, instead of:</p> <pre><code>hasMany: [ {model: 'Pages', name: 'autoPages', associationKey: 'autoOptions.pages'}, {model: 'Pages', name: 'seleniumPages', associationKey: 'seleniumOptions.pages'} ], </code></pre> <p>I added:</p> <pre><code>hasMany: [ {model: 'Pages', name: 'autoPages', associationKey: 'autoOptions', reader: {root: 'pages'}}, {model: 'Pages', name: 'seleniumPages', associationKey: 'seleniumOptions', reader: {root: 'pages'}} ], </code></pre> <p>Suddenly, I am able to access my data from record.getAssociatedData(), it is still flattened, but at least I have the data.</p> <p>I still don't have a good idea about having the writer output the data in its original format other than writing it as I did in brute force. Would again love some feedback on that.</p> <p>Other questions arose: I want my associated data to be added to a form. As we are talking about arrays of objects, we don't know how many there will be, is there a better way to create the form from associated data than the one I used in my original question. Is there a better way to access the form data, other than naming the fields with a running iterator: a1, a2,...</p> <p>Thanks in advance for any answer.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload