PDA

View Full Version : Nested List and nested models ?



shrell
7 Dec 2010, 2:49 AM
Hello
I have a question, i want to use a nested list to find details about car parts.
Here are my models :

Ext.regModel("Category", {
fields: [
'id_category',
'name'
],

hasMany: [
{model: 'Car', name: 'cars'},
]
});

Ext.regModel("Car", {
fields: [
'id_car',
'model'
],

hasMany: [
{model: 'Part', name: 'parts'},
]
});

Ext.regModel("Part", {
fields: [
'id_part',
'name',
'price',
'currency',
'picture_url'
]
});
I can't find the way to set up my treestore for my nested list, actually i don't know wich model i should set in my store.
Can someone help or tell me what i'm doing wrong ?
Thanks by advance

edspencer
10 Dec 2010, 6:29 PM
This is something we're working on - not supported yet. NestedList currently uses just a single Model.

kortovos
12 Dec 2010, 11:42 PM
A solution would be to use one model and put all the attributes you need into this one model. (Id, name, price, currency, model and picture_url) Nothing says that a record has to use all its attributes.

shrell
20 Dec 2010, 7:39 AM
Yes that's what i ended up doing ;-)
Thank you !

vishr
8 Jul 2011, 3:17 PM
I have not seen any examples or mention of linked models with nestedlist. Is this still not supported?

edspencer
8 Jul 2011, 3:27 PM
Not in 1.x, no

JavascriptParrot
14 Dec 2011, 7:11 AM
Will this implemented in Touch 2?

I have the same problem as above, whats the best solutions to do this? All fields in one model or use two lists?
After tap an item on the first list showing up the second list with the items from the tapped record?

Edit: This is a litle piece off JSON I have



{"success":true, "msg":[{"products":[{"nr":5693,"nm":"Elastiek spoel bind","anm":"","c":"V","pI":{"sut":"Stuk","suts":"ST","p":[{"v":1,"q":1,"uT":"Spoel","uTS":"SL"},{"v":2,"q":12,"uT":"Doos","uTS":"DS"},{"v":3,"q":288,"uT":"Pallet","uTS":"PL"}]}},{"nr":6491,"nm":"Gedemineraliseerd water","anm":"in statiegeld cans","c":"V","pI":{"sut":"Kilogram","suts":"KG","p":[{"v":1,"q":20,"uT":"Can","uTS":"CN"},{"v":2,"q":560,"uT":"Pallet","uTS":"PL"}]}},{"nr":6242,"nm":"Kraan uitloop t.b.v. multibox","anm":"","c":"V","pI":{"sut":"Stuk","suts":"ST","p":[{"v":1,"q":1,"uT":"Stuk","uTS":"ST"},{"v":2,"q":2000,"uT":"Pallet","uTS":"PL"}]}},{"nr":6639,"nm":"Stoomzeil 0.15mu - 9.50 breed","anm":"maatbestelling","c":"V","pI":{"sut":"Vierkante meter","suts":"M2","p":[{"v":3,"q":1000,"uT":"Pallet","uTS":"PL"}]}}],"nr":4,"nm":"Diverse artikelen"},{"products":[{"nr":5465,"nm":"60.28.8 CPP30 HM","anm":"witte doos","c":"V","pI":{"sut":"Stuk","suts":"ST","p":[{"v":1,"q":3000,"uT":"Doos","uTS":"DS"},{"v":2,"q":156000,"uT":"Pallet","uTS":"PL"}]}},{"nr":5119,"nm":"60.28.8 CPP30 WWW","anm":"","c":"V","pI":{"sut":"Stuk","suts":"ST","p":[{"v":1,"q":3000,"uT":"Doos","uTS":"DS"},{"v":2,"q":156000,"uT":"Pallet","uTS":"PL"}]}},{"nr":4979,"nm":"60.30.10 CPP30 HM","anm":"witte doos","c":"V","pI":{"sut":"Stuk","suts":"ST","p":[{"v":1,"q":2500,"uT":"Doos","uTS":"DS"},{"v":2,"q":130000,"uT":"Pallet","uTS":"PL"}]}},{"nr":5052,"nm":"65.32.9 CPP30 HM","anm":"","c":"V","pI":{"sut":"Stuk","suts":"ST","p":[{"v":1,"q":2000,"uT":"Doos","uTS":"DS"},{"v":2,"q":104000,"uT":"Pallet","uTS":"PL"}]}},{"nr":5683,"nm":"65.32.9 CPP30 HM","anm":"150 bnd","c":"V","pI":{"sut":"Stuk","suts":"ST","p":[{"v":1,"q":2100,"uT":"Doos","uTS":"DS"},{"v":2,"q":109200,"uT":"Pallet","uTS":"PL"}]}},{"nr":6318,"nm":"Tape grijs 75mm","anm":"50 m op rol","c":"V","pI":{"sut":"Stuk","suts":"ST","p":[{"v":1,"q":1,"uT":"Stuk","uTS":"ST"},{"v":2,"q":999999,"uT":"Pallet","uTS":"PL"}]}},{"nr":6305,"nm":"Tape grijs 100mm","anm":"","c":"V","pI":{"sut":"Stuk","suts":"ST","p":[{"v":1,"q":1,"uT":"Stuk","uTS":"ST"},{"v":2,"q":999999,"uT":"Pallet","uTS":"PL"}]}}],"nr":6,"nm":"Verpakkingen"}]}


So the field nr and nm has to be in the first list, after tap shows the items in products. Whats the best way to that...

Thanks,
Freez