Note that there are some explanatory texts on larger screens.

plurals
  1. PONo 'addArrayObserver' or 'removeArrayObserver'
    primarykey
    data
    text
    <p>I am modelling an administrative interface that helps manage database tables. There are two models: [DbxTables, DbxColumns]. I want to allow the user to choose a table using Boostrap's tab-menu and then be able to see the columns in that table. This mostly works. For instance, if I type <code>http://my.domain.com/index.html#/performance</code> where <code>performance</code> is the name of the <em>table</em> I get the following:</p> <p><img src="https://i.stack.imgur.com/ah0Jn.png" alt="performance table"></p> <p>If I decide to go to another table by manipulating the URL -- for instance <code>http://my.domain.com/index.html#/food</code>-- then it will successfully switch to the food columns in the right-hand pane. The problems come in when I use my {{linkTo}} links in the left-hand tab menu. One of two things happens:</p> <ol> <li>If the {{linkTo}} looks like <code>{{linkTo 'columns' this}}</code> then it makes the URL parameter something like <code>&lt;App.DbxTable:ember371:performance&gt;</code> rather than just <code>performance</code></li> <li>If the {{linkTo}} looks like <code>{{linkTo 'columns' this.id}}</code> then it sets the ULR parameter correctly (or at least so it appears to in the URL window) but the if I click on "meal" in the left-hand tab menu I get the following error: <em>Object meal has no method 'addArrayObserver'</em>. If I click on something else it follows that error message with "<em>Object meal has no method 'removeArrayObserver'</em> ". </li> </ol> <p>In both of the above cases, after receiving an error, the column names on the right hand side do not update. The first style of {{linkTo}} is what the <a href="https://www.youtube.com/watch?v=Ga99hMi7wfY" rel="nofollow noreferrer">screencast</a> from Tom Dale seemed to suggest was the right syntax. However, seeing that the links were off I came up with the <code>this.id</code> approach. Any help would be greatly appreciated.</p> <p>For some additional code context (router.js):</p> <pre><code>App.Router.map(function() { this.resource('about'); this.resource('dbx', function() { this.resource('columns', { path: ':dbx_table'}); }); this.resource('oauth'); this.resource('postTypeMappings'); }); App.DbxRoute = Ember.Route.extend({ model: function() { return App.DbxTable.find(); } }); App.ColumnsRoute = Ember.Route.extend({ model: function(table) { return App.DbxColumn.find(table); } }); </code></pre> <p>Model: dbx_table.js</p> <pre><code>App.DbxTable = DS.Model.extend({ name: DS.attr("string"), desc: DS.attr("string"), db_column: DS.attr("string"), columns: DS.attr("raw") }); </code></pre> <p>Model: dbx_column.js</p> <pre><code>App.DbxColumn = DS.Model.extend({ name: DS.attr("string"), dbType: DS.attr("string"), insight: DS.attr("string"), enum: DS.attr("string"), staticUom: DS.attr("string"), uomContext: DS.attr("string"), jsonStruct: DS.attr("string"), desc: DS.attr("string") }); </code></pre> <p>Model: store.js</p> <pre><code>App.Store = DS.Store.extend({ revision: 12, adapter: DS.RESTAdapter.reopen({ namespace: 'api/lifegadget' }) }); DS.RESTAdapter.registerTransform('raw', { deserialize: function(serialized) { return serialized; }, serialize: function(deserialized) { return deserialized; } }); </code></pre> <p>UPDATE (adding handlebars):</p> <p>In order to provide some more detail. Here are the handlebars templates:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset=utf-8 /&gt; &lt;title&gt;Ember Starter Kit&lt;/title&gt; &lt;link rel="stylesheet" href="css/normalize.css"&gt; &lt;link rel="stylesheet" href="css/bootstrap.css"&gt; &lt;link rel="stylesheet" href="css/style.css"&gt; &lt;/head&gt; &lt;body&gt; &lt;script type="text/x-handlebars"&gt; &lt;div class="navbar"&gt; &lt;div class="navbar-inner"&gt; &lt;a class="brand" href="#"&gt;Admin&lt;/a&gt; &lt;ul class="nav"&gt; &lt;li&gt;{{#linkTo "dbx"}}DBX{{/linkTo}}&lt;/li&gt; &lt;li&gt;{{#linkTo "postTypeMappings"}}Post Mappings{{/linkTo}}&lt;/li&gt; &lt;li&gt;{{#linkTo "oauth"}}OAuth{{/linkTo}}&lt;/li&gt; &lt;li&gt;{{#linkTo "about"}}About{{/linkTo}}&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="outlet-target"&gt; {{outlet}} &lt;/div&gt; &lt;/script&gt; &lt;script type="text/x-handlebars" id="about"&gt; &lt;div class='about'&gt; Admin Screen &lt;/div&gt; &lt;/script&gt; &lt;script type="text/x-handlebars" id="dbx"&gt; &lt;div class='dbx'&gt; &lt;div id="dbx-table-pane" class="tabbable tabs-left"&gt; &lt;ul class="nav nav-tabs"&gt; {{#each model}} &lt;li&gt; {{#linkTo "columns" this}}{{db_column}}{{/linkTo}} &lt;/li&gt; {{/each}} &lt;li id="add-table"&gt; &lt;a href="#section-add-table" data-toggle="tab"&gt;&lt;em&gt;Add DBX Table&lt;/em&gt;&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;div id="dbx-main" class="tab-content"&gt; {{outlet}} &lt;/div &lt;/div&gt; &lt;/script&gt; &lt;script type="text/x-handlebars" id="columns"&gt; The columns are: &lt;ul&gt; {{#each model}} &lt;li&gt;{{name}}&lt;/li&gt; {{/each}} &lt;/ul&gt; &lt;/script&gt; &lt;script src="js/libs/jquery-1.9.1.js"&gt;&lt;/script&gt; &lt;script src="js/libs/handlebars-1.0.0-rc.3.js"&gt;&lt;/script&gt; &lt;script src="js/libs/ember-1.0.0-rc.2.js"&gt;&lt;/script&gt; &lt;script src="js/libs/ember-data-12.js"&gt;&lt;/script&gt; &lt;script src="js/app.js"&gt;&lt;/script&gt; &lt;script src="js/router.js"&gt;&lt;/script&gt; &lt;script src="js/models/store.js"&gt;&lt;/script&gt; &lt;script src="js/models/dbx_table.js"&gt;&lt;/script&gt; &lt;script src="js/models/dbx_column.js"&gt;&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>UPDATE 2:</p> <p>I've now added a short video that demonstrates the problem: <a href="https://vimeo.com/63388787" rel="nofollow noreferrer">https://vimeo.com/63388787</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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