View Full Version : Load Array values into store using Model

11 Feb 2016, 5:42 PM
I feel like I may be over complicating this. Please feel free to send me in a different direction.
I'm trying to load an array of records (the values) with only values, into model objects, using the fields defined in my model (the keys).

My Model

Ext.define('MyApp.model.AppData', {
extend: 'Ext.data.Model',
fields: [
{name: 'key'},
{name: 'value'},
{name: 'desc'},
{name: 'index', type: 'int'},
{name: 'type'}

My Store

Ext.define('MyApp.store.AppData', {
extend: 'Ext.data.ArrayStore',
groupField: 'type',
model: 'MyApp.model.AppData',
autoload: false,
constructor: function (config) {
var data = [
['val1', 'val2', 'val3', 'val4', 'val5'],
['val1', 'val2', 'val3', 'val4', 'val5'],

So the end goal here is to have my data in the store looking like

{'key':'val1', 'value':'val2', 'desc':'val3', 'index':'val4', 'type':'val5'},

Currently getting a 'me.removed is undefined' error. I know its related to the loadData() function. Which makes me feel like I'm not using this correctly somewhere.

I could just hardcode the data formatted with the key value pairs... but that just feels unmaintainable and wrong way to do this.