-
7 Apr 2011 8:56 PM #1
[CLOSED]Selection of Association in DataView
[CLOSED]Selection of Association in DataView
I am getting the following error when I try to select an item in a DataView that is actually an association of the model included in the store passed to the DataView.
Uncaught TypeError: Cannot read property 'internalId' of undefined ext-all-debug.js (line 45224)
Uncaught TypeError: Cannot read property 'id' of undefined ext-all-debug.js:32147
Should I be able to do this or is it intended that you would only select items from the root model passed into the DataView?
Code:Ext.onReady(function() { Ext.regModel('Scheme', { fields: ['id', 'name'], hasMany: 'Category', proxy: { type: 'ajax', url : 'schemes.json' } }); Ext.regModel('Category', { fields: ['id', 'name'], belongsTo: 'Scheme', }); var store = new Ext.data.Store({ autoLoad: true, model: 'Scheme', storeId: 'schemeStore', listeners : { load : function() { console.log(arguments); } } }); var tpl = new Ext.XTemplate( '<tpl for=".">', '<div><span class="item">{name}</span></div>', '<tpl for="categories">', '<div><span class="item">{name}</span></div>', '</tpl>', '</tpl>' ); var dataview = new Ext.DataView({ renderTo: Ext.getBody(), store: store, tpl: tpl, itemSelector: 'span.item', selectedItemCls: 'selected', listeners: { selectionChange: function(dataview, index, node, e) { console.log(arguments); } } }); });
-
7 Apr 2011 9:13 PM #2
Post your data as well please.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
7 Apr 2011 9:33 PM #3
The more I think about it I am pretty sure I am just trying to doing something stupid here.
Code:[ { id: 1, name: 'Scheme1', categories: [ { id: 1, name: 'Category1' }, { id: 2, name: 'Category2' } ] } ]
-
7 Apr 2011 11:08 PM #4
The problem is that you're duplicating the itemSelector. So for each record, you've categories.length + 1 data view selection items. Make sense?
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
29 Nov 2011 12:07 PM #5
I dont understand
I dont understand
What was the solution for this issue? i have the same problem for a tree, this is my code:
Code:{ text: '.', children: [{ text:'Cátalogos', icon:'images/icons/application_cascade.png', expanded: true, children:[{ text:'Empresas', icon:'images/icons/overlays.png', id:'absolute', leaf:true },{ text:'Proveedores', icon:'images/icons/group_gear.png', id:'accordion', leaf:true },{ text:'Clientes', icon:'images/icons/group.png', id:'anchor', leaf:true },{ text:'Empresas reembolso', icon:'images/icons/key_go.png', id:'border', leaf:true },{ text:'Empleados', icon:'images/icons/status_online.png', id:'card-tabs', leaf:true },{ text:'Asignar turnos', icon:'images/icons/time_go.png', id:'card-wizard', leaf:true },{ text:'Puntos empleado', icon:'images/icons/medal_gold_1.png', id:'column', leaf:true },{ text:'Metas empleado', icon:'images/icons/medal_bronze_2.png', id:'fit', leaf:true },{ text:'Asignar producto a proveedores', icon:'images/icons/user_go.png', id:'table', leaf:true },{ text:'Asignar proveedor a productos', icon:'images/icons/user_comment.png', id:'vbox', leaf:true },{ text:'Cátalogo de clientes', icon:'images/icons/user_suit.png', id:'hbox', leaf:true }] },{ text:'Productos', icon:'images/icons/car.png', id:'productos', children:[{ text:'Tipos de productos', icon:'images/icons/cart_put.png', id:'center', leaf:true }] },{ text:'Configuración', icon:'images/icons/cog.png', id:'config', children:[{ text:'Zonas de impuestos', icon:'images/icons/money.png', id:'center', leaf:true }] },{ text:'Turnos', icon:'images/icons/time.png', id:'turnos', children:[{ text:'Consultar turnos', icon:'images/icons/time_go.png', id:'abs-form', leaf:true },{ text:'Detalle de turno', icon:'images/icons/timeline_marker.png', id:'tabs-nested-layouts', leaf:true }] }] }
-
8 Feb 2012 2:54 PM #6
You have more than one node with the same id.
You have more than one node with the same id.
In your case you have more than one id: 'center'. (There may be others.)
-
25 Sep 2012 10:43 PM #7
i am facing same problem, my data layout like this
[{
categories: [
{ id: 1, name: 'Category1' },
{ id: 2, name: 'Category2' }
],
colors: [
{ id: 1, name: 'Color1' },
{ id: 2, name: 'Color2' }
]
}]
please suggest me
Thank you for reporting this bug. We will make it our priority to review this report.
Similar Threads
-
[CLOSED]DataView ctrl/shift selection(s) is highlighting text
By meroy in forum Ext 3.x: BugsReplies: 4Last Post: 23 Sep 2010, 5:32 AM -
Grid and Dataview selection problem
By odandi in forum Ext 3.x: Help & DiscussionReplies: 3Last Post: 11 May 2010, 11:46 AM -
[2.2] DataView Selection and Remove
By hast in forum Ext 2.x: BugsReplies: 3Last Post: 15 Jan 2009, 3:35 AM -
Dataview + template selection problem
By assassin in forum Ext GWT: Help & Discussion (1.x)Replies: 0Last Post: 9 Jun 2008, 2:09 AM


Reply With Quote