-
7 May 2011 7:19 AM #1
Ext.Direct with Dataview
Ext.Direct with Dataview
HI,
I am using Ext.direct and Dataview but I can't reach to get it working.
How do I need to format my json result from ext.direct output to get it work ?
(ExtJS 4.0)
Many thanks in advance for any answer !
-
8 May 2011 10:16 PM #2
this has nothing to do with ExtDirect. Is the store filled, is the XTemplate correct?
vg Steffen
--------------------------------------
Release Manager of TYPO3 4.5
energlobe.de - german online magazine
-
9 May 2011 1:14 AM #3
Sotre not filled
Sotre not filled
Hi thanks for your answer.
My Store is not filled and XTemplate is correct. When I use XDebug
to create entities and to add them in the Store everything is working
And appearing in the dataview.
My Problem is the loading part.
My Json output is like this:
And My ModelPHP Code:{
"tid" : 1,
"action" : "Items",
"method" : "getProducts",
"result" : {
"data" : [{"id":1,"name":"test 1","description 1":"blabla 1","medias":[]}],
"total" : 1,
"success" : true
},
"type" : "rpc"
}
And my Model :PHP Code:Ext.define('IQ.model.Product', {
extend: 'Ext.data.Model',
fields: ['name', 'description']
hasMany : {model: 'Media', name: 'medias'}
});
Ext.define('IQ.model.Media', {
extend: 'Ext.data.Model',
fields: [
'product_id',
{name: 'isDefault', type:'boolean', defaultValue: false},
'path'
],
belongsTo: 'Product'
});
Does it appear correct to You ?PHP Code:Ext.define('IQ.store.Product', {
extend: 'Ext.data.Store',
model: 'IQ.model.Product',
autoLoad: true,
proxy: {
type: 'direct',
directFn: IQ.Remote.Items.getProducts,
paramsAsHash: true,
reader: {
type: 'json',
model: 'IQ.model.Product',
root: 'data',
totalProperty: 'total',
successProperty: 'success',
messageProperty: 'message'
}
}
});
-
9 May 2011 5:24 AM #4
not really. The id should appear in the first model. Also try reducing code until it works, eg remove association and second model for a try.
Add a store load listener and verify records are added in the store with debug or console output.vg Steffen
--------------------------------------
Release Manager of TYPO3 4.5
energlobe.de - german online magazine
-
9 May 2011 8:20 AM #5
test
test
Hi again,
I removed relations and I added id to the Product Model.
I then added a load listener to the store. The records are there.
In the listeners I can do something like
And the output is correct ('test 1')PHP Code:var x = records[0];
var string = x.get('name');
console.log(string);
But the records are not added to the store.
-
9 May 2011 1:04 PM #6
this doesn't make sense - if the records are there, the store is filled.
Use the console to explore, eg add this to your store:
Code:listeners: { load: function(store){ console.log(store.getCount(), store.getAt(0).data); } }vg Steffen
--------------------------------------
Release Manager of TYPO3 4.5
energlobe.de - german online magazine
-
10 May 2011 1:47 AM #7
Thanks !
Thanks !
Many thanks for your answers. It helped me to realize
how stupid I am. Of course everything is fine in the store.
The problem was that in my view an other store was
applied to my dataview. That's why I could add with
firebug but not with the store in this post.
I just changed my dataview config to
Many thanks again for you help.PHP Code:store: new IQ.store.Product(),
-
10 May 2011 3:53 AM #8
great that it helped finding your problem
vg Steffen
--------------------------------------
Release Manager of TYPO3 4.5
energlobe.de - german online magazine
Similar Threads
-
Drag from DataView drop in another DataView... HELP!!!
By danielbertini in forum Ext 3.x: Help & DiscussionReplies: 3Last Post: 5 Nov 2010, 2:56 PM -
Simple Ext.Direct-Combobox plugin --- with Ext.Direct.Store for reuse
By xp743 in forum Ext 3.x: User Extensions and PluginsReplies: 1Last Post: 26 Jul 2010, 11:56 AM -
DataView Drag Issue: After creating first Portlet into Portal from DataView
By amitkrgarg in forum Ext 3.x: Help & DiscussionReplies: 0Last Post: 7 Apr 2010, 1:24 PM -
DnD DataView to DataView with reorder - ScrollManager problem
By gumby in forum Ext 3.x: Help & DiscussionReplies: 1Last Post: 31 Mar 2010, 1:14 PM -
[2.1][FIXED] DataView.getNodes() when called on an empty dataview
By Deramo in forum Ext 2.x: BugsReplies: 1Last Post: 31 May 2008, 8:59 AM


Reply With Quote