Results 1 to 7 of 7

Thread: HELP* GroupingStore + JSON

  1. #1

    Default HELP* GroupingStore + JSON

    here is my code. it doesn't work correctly!
    data of store doesn't apper on my grid panel.

    how can i do? please help me!

    PHP Code:
    var ds = new Ext.data.GroupingStore({
                   
    url:'url',
                   
    reader: new Ext.data.JsonReader({
                       
    id'id',
                    
    root'plans'
                
    },[
                    {
    name:'id',mapping:'id'},
                    {
    name:'title'mapping:'title'},
                    {
    name:'comment',mapping:'comment'},
                    {
    name:'from_time',mapping:'from_time'},
                    {
    name:'updated_at',mapping:'updated_at'}
                   ]),
                   
    sortInfo:{
                       
    field'id'
                    
    direction"ASC"
                
    },
                   
    groupField'from_time',
                
    groupOnSort:true,
                
    remoteGrouptrue
              
    });
                    
    ds.load();
            var 
    plan_list = new Ext.grid.GridPanel({
                
    store:ds,
                   
    columns: [
                    {
    id:'id',header'id'sortabletruedataIndex'id'},
                       {
    header:'from_time'sortabletruedataIndex'from_time'},
                       {
    header:'title'sortabletruedataIndex'title'},
                       {
    header:'detail',sortablefalsedataIndex'comment'},
                    {
    header:'updated_at',sortable:false,dataIndex:'updated_at'}
                   ],
                
    autoWidth:true,
                
    frame:true,        
                
    view: new Ext.grid.GroupingView({
                    
    forceFit:true,
                    
    groupTextTpl'{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'
                
    }), 
                
    title'plans',
                
    iconCls'icon-grid'
            
    });
            
    plan_list.render('plan-list'); 

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246

    Default

    This is often caused by a mismatch between the returned JSON data and the configuration of the JSON reader.

    Could you post an example of your JSON data?

  3. #3

    Default

    thank you for your message.

    yes, i can show you my json data.

    Code:
    {"plans":
     [{"id":980,"title":"study","comment":null,"from_time":"2008-01-01","updated_at":"2007-12-10 14:16:11"},
     {"id":983,"title":"dinner","comment":null,"from_time":"2008-01-02","updated_at":"2007-12-11 15:17:37"},
     {"id":982,"title":"work","comment":null,"from_time":"2008-01-02","updated_at":"2007-12-11 15:17:32"},
     {"id":984,"title":"study","comment":null,"from_time":"2008-01-03","updated_at":"2007-12-11 15:17:47"}]}

  4. #4
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246

    Default

    The data displays fine on my PC (after I specify a height for the gridpanel).

    Are you sure you have entered the correct URL in the store?

  5. #5

    Default

    >Are you sure you have entered the correct URL in the store?
    yes, i have. i confirmed by firebug console.

    tough i can't tell you URL , i show you a print screen.

  6. #6

    Default

    here is a json data
    Attached Images Attached Images

  7. #7
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246

    Default

    As I said, the grid displays fine on my PC (after setting autoHeight:true). There must be something wrong with the surrounding code.

Posting Permissions

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