first time useing grouping and I don’t know how to fix this problem.

March 10th, 2010 | Posted by rose under enart.qthx.com with
  • Can anyone see what I have done wrong, the grid displays but without a title or any data, I know the JsonStore is returning data.

    This is the first time I have used grouping and I don’t know what else to do to fix this problem.

    var ds = new Ext.data.JsonStore({
    url: './data-search.php?string=',
    root: 'data',
    fields: [
    'link',
    'meta',
    'type'
    ]
    });
    ds.load();

    Ext.onReady(function() {
    Ext.QuickTips.init();
    // turn on validation errors beside the field globally

    var reader = new Ext.data.ArrayReader({}, [
    {name: 'link'},
    {name: 'meta'},
    {name: 'type'}
    ]);

    Ext.form.Field.prototype.msgTarget = 'side';

    // create the Grid
    var grid = new Ext.grid.GridPanel({
    width:500,
    height:550,
    frame:true,
    bodyStyle:'text-align:left;',
    title:'Search results for ""',

    store: new Ext.data.GroupingStore({
    reader: reader,
    data: Ext.grid.ds,
    sortInfo:{field: 'name'},
    groupField:'type'
    }),

    columns: [
    {id:'link',header: "Link", width: 100, sortable: true, locked:false, dataIndex: 'link'},
    {header: "Meta", width: 200, sortable: true, dataIndex: 'meta'},
    {header: "Type", width: 200, sortable: true, dataIndex: 'type'}
    ],

    view: new Ext.grid.GroupingView({
    forceFit:true
    })
    });

    grid.render('results');


    });Thanks,
    Levi


  • Ok I may have been telling a bit of a fib, I used an array instead of a JsonStore and all is well.

    Thanks for the help, I can now head off to the pub gilt free.



    :D


  • Thanks for the quick reply.
    I was hoping that would be a nice easy fix, however that didn’t seem to fix the problem.
    Found an error with GroupingStore but that didn't seem to help either.

    Any other suggestion?

    Its Friday afternoon and I want to go have a few drinks however I cant go until I get this going. :(( What a cruel would... ;)




    var ds = new Ext.data.JsonStore({
    url: './data-search.php?string=test',
    root: 'data',
    fields: [
    'link',
    'meta',
    'type'
    ]
    });

    Ext.onReady(function() {
    Ext.QuickTips.init();
    // turn on validation errors beside the field globally

    var reader = new Ext.data.ArrayReader({}, [
    {name: 'link'},
    {name: 'meta'},
    {name: 'type'}
    ]);

    Ext.form.Field.prototype.msgTarget = 'side';

    // create the Grid
    var grid = new Ext.grid.GridPanel({
    //maxHeight:550,
    frame:true,
    bodyStyle:'text-align:left;',
    title:'Search results for',

    store: new Ext.data.GroupingStore({
    reader: reader,
    data: Ext.grid.ds,
    sortInfo:{field: 'link'}, // <-- was name not link
    groupField:'type'
    }),

    columns: [
    {id:'link',header: "Link", width: 100, sortable: true, locked:false, dataIndex: 'link'},
    {header: "Meta", width: 200, sortable: true, dataIndex: 'meta'},
    {header: "Type", width: 200, sortable: true, dataIndex: 'type'}
    ],

    view: new Ext.grid.GroupingView({
    forceFit:true
    })
    });

    grid.render('results');

    ds.load();

    });


  • Hold off on your store.load until after the grid is rendered. Then you'll see some action. :D


  • Why are you passing a JsonStore as the data?


  • I have just used JsonStore in the past, i find it the easyest way to get data from the database.

    I didn't think it mattered what type of Store i used. I gave it a go with an Array as well and same issue.







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about first time useing grouping and I don’t know how to fix this problem. , Please add it free.
    edit