Results 1 to 2 of 2

Thread: data.Store populates grid but getCount returns 0

  1. #1

    Default data.Store populates grid but getCount returns 0

    My grid is properly populated from my data store but when I call getCount() it returns 0.
    Since the grid fills in correctly the data store is os obviously populated by my XML reader and I know it's done asynchronously but I think I've accounted for that. (I do all the processing in response to the load event)

    Any ideas? I call both getCount and getTotalCount but both return 0.

    function fieldsLoaded(FieldStore) { var grid = new Ext.grid.GridPanel({
    store: FieldStore,
    columns: [
    {header: "name", width: 120, dataIndex: 'name', sortable: true},
    {header: "label", width: 180, dataIndex: 'label', sortable: true},
    ],
    renderTo:'example-grid',
    width:540,
    height:200
    });

    console.log(FieldStore.getCount() );
    console.log(FieldStore.getTotalCount() );

    };

    Ext.onReady(function(){
    var HttpProxy = new Ext.data.HttpProxy({url: 'Template.xml'});

    var FieldStore = new Ext.data.Store({
    proxy:HttpProxy,
    reader: new Ext.data.XmlReader( {record: 'domain[@name=Blank 1] field'},
    [{name: 'name', mapping: '@name'},{name: 'label', mapping: '@label'}] )
    });
    FieldStore.load();
    FieldStore.on('load', fieldsLoaded(FieldStore));
    });

  2. #2

    Default Fixed

    I never figured out the problem but in testing, debugging and rewriting I ended up with rewritten code that is working.

Posting Permissions

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