View Full Version : Rowexp + json, left outer join

10 Dec 2009, 3:32 AM
Its not a problem I have... just want to know how to do something (I dont need code), just some information. Tried already something but I dont get it :-/

What I did so far and works great is
1. DB = 2 tables (table1.ID = table2.tID)
2. I do a left outer join where table1.ID = table2.tID (php, json creation is ok)
3. Grid + rowexpander = ok, with 3 tbar.buttons : add (form), del, add reply (form) = ok
('add reply' gets ID from selected row and puts a reply in table 2)

Question is now:
How to put the replies (from table2) in the corresponding expander (table1.ID = table2.tID).
Do I need the index of grid.row then a search in Json where grid.row.index = table2.tID (looping to get all results)? :-/

See picture ( expander.replies is now a string created in php, but in the future I want to make it posible to delete the replies in the expander (so using 1 big string with all replies in it is not a sollution)

Thank you.

10 Dec 2009, 4:04 AM
Are you creating nested JSON data?

10 Dec 2009, 7:39 AM
No, I dont create a nested array.

So you recommend a nested array? or is 'one' array better /faster?
I know the 'one'-array will take much more data but I dont know whats the best sollution for the use in extjs?

Hmm, is it better to do all the sql things in php and the rest in extjs.
The more you can do in php, the better it is for extjs?

10 Dec 2009, 7:57 AM
The best JSON data layout for your grid would be a nested array, e.g.

['type1', 'test 001', [
['some message'],
['other message']
['type2', 'test 002', [
['and now for something completely different']
['type2', 'test 003', [
['server down'],
['test ok']