1. #1
    Ext User
    Join Date
    Nov 2009
    Posts
    11
    Vote Rating
    0
    RedJane is on a distinguished road

      0  

    Default Rowexp + json, left outer join

    Rowexp + json, left outer join


    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.
    Attached Images

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    92
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Are you creating nested JSON data?

  3. #3
    Ext User
    Join Date
    Nov 2009
    Posts
    11
    Vote Rating
    0
    RedJane is on a distinguished road

      0  

    Default


    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?

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    92
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    The best JSON data layout for your grid would be a nested array, e.g.
    Code:
    [
      ['type1', 'test 001', [
        ['some message'],
        ['other message']
      ]],
      ['type2', 'test 002', [
        ['and now for something completely different']
      ]],
      ['type2', 'test 003', [
        ['server down'],
        ['test ok']
      ]]
    ]

Thread Participants: 1