Results 1 to 3 of 3

Thread: [SOLVED] How to filter a grid or a data store on a foreign key

  1. #1
    Sencha User
    Join Date
    Aug 2009
    Posts
    113

    Red face [SOLVED] How to filter a grid or a data store on a foreign key

    Hello,

    I have two grids in a window, which each have their data in store1 and store2.

    When I select a row in a left one, I would like to filter the right one with the key selected.

    I know to get the foreign key of the left grid :

    Code:
            listeners: {
                rowclick: function(g, index, ev) {
                    var id = g.store.getAt(index).data.id_projet;
                  }
           }
    But now, how filter the second (store2) grid with the id selected ?

  2. #2
    Sencha User
    Join Date
    Aug 2009
    Posts
    113

    Default

    I am near the solution, I do a server side filtering, that work, data come filtered :

    Code:
            listeners: {
                rowclick: function(g, index, ev) {                
                    store_action.reload( { params: {requete_appli: " where id_projet_action='"+id+"'"} } ) ;
                }
            }
    But I have juste a problem grid isn't empty when store.reload.

    I explain:

    1. If I select a row in grid 1 with no same id_projet_action in store_action, nothing appear in grid 2 (That's OK)
    2. If I select a row in grid 1 with same id_projet_action in store_action, data linked appear in grid 2 (That's OK)
    3. After that, if I select a row in grid 1 with no same id_projet_action in store_action, old data appear in grid 2 (That's not OK)

    Also how delete all data in a grid to empty it before the reload ?

  3. #3
    Sencha User
    Join Date
    Aug 2009
    Posts
    113

    Default

    Solved !

    The solution :

    Code:
    store_action.removeAll();
    store_action.reload( { params: {requete_appli: " where id_projet_action='"+id+"'"} } ) ;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •