1. #1
    Ext JS Premium Member
    Join Date
    Apr 2007
    Location
    Geneva
    Posts
    20
    Vote Rating
    0
    cricri is on a distinguished road

      0  

    Default 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 !

  2. #2
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,657
    Vote Rating
    5
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    this has nothing to do with ExtDirect. Is the store filled, is the XTemplate correct?
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  3. #3
    Ext JS Premium Member
    Join Date
    Apr 2007
    Location
    Geneva
    Posts
    20
    Vote Rating
    0
    cricri is on a distinguished road

      0  

    Default 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:
    PHP 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'defaultValuefalse},
            
    'path'
        
    ],
        
    belongsTo'Product'
    }); 
    And my Model :

    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'
            
    }
        }

    }); 
    Does it appear correct to You ?

  4. #4
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,657
    Vote Rating
    5
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    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

  5. #5
    Ext JS Premium Member
    Join Date
    Apr 2007
    Location
    Geneva
    Posts
    20
    Vote Rating
    0
    cricri is on a distinguished road

      0  

    Default 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
    PHP Code:
        var records[0];
        var 
    string x.get('name');
        
    console.log(string); 
    And the output is correct ('test 1')

    But the records are not added to the store.

  6. #6
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,657
    Vote Rating
    5
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    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

  7. #7
    Ext JS Premium Member
    Join Date
    Apr 2007
    Location
    Geneva
    Posts
    20
    Vote Rating
    0
    cricri is on a distinguished road

      0  

    Thumbs up 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

    PHP Code:
      store: new IQ.store.Product(), 
    Many thanks again for you help.

  8. #8
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,657
    Vote Rating
    5
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    great that it helped finding your problem
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

Similar Threads

  1. Drag from DataView drop in another DataView... HELP!!!
    By danielbertini in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 5 Nov 2010, 2:56 PM
  2. Simple Ext.Direct-Combobox plugin --- with Ext.Direct.Store for reuse
    By xp743 in forum Ext 3.x: User Extensions and Plugins
    Replies: 1
    Last Post: 26 Jul 2010, 11:56 AM
  3. DataView Drag Issue: After creating first Portlet into Portal from DataView
    By amitkrgarg in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 7 Apr 2010, 1:24 PM
  4. DnD DataView to DataView with reorder - ScrollManager problem
    By gumby in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 31 Mar 2010, 1:14 PM
  5. Replies: 1
    Last Post: 31 May 2008, 8:59 AM

Thread Participants: 1

Tags for this Thread