1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    17
    Vote Rating
    0
    sachinrathore is on a distinguished road

      0  

    Default Unanswered: store loaded but grid is not loaded using json

    Unanswered: store loaded but grid is not loaded using json


    Hi all,
    I have loaded my store from json but my grid is not populated.

    Below is my store:

    Ext.define('NotesApp.store.Grid', {
    extend : 'Ext.data.Store',


    requires: [
    'Ext.data.proxy.JsonP',
    "Ext.data.Model"

    ],
    config: {
    model:"NotesApp.model.Grid",
    autoLoad:true,
    proxy: {
    type:'ajax',
    url: "contacts.json",
    reader: {
    rootProperty:'contacts',
    type:'json'
    }


    }


    }
    });

    Please reply me.......

    thanks
    sachinrathore

  2. #2
    Sencha User bluehipy's Avatar
    Join Date
    Mar 2010
    Location
    Romania
    Posts
    609
    Vote Rating
    26
    Answers
    66
    bluehipy will become famous soon enough bluehipy will become famous soon enough

      0  

    Default


    Why JsonP if url is relative to local "contact.json" ?

    Also you should show how you are using the defined store.

  3. #3
    Sencha User
    Join Date
    Jul 2012
    Posts
    17
    Vote Rating
    0
    sachinrathore is on a distinguished road

      0  

    Default


    Quote Originally Posted by bluehipy View Post
    Why JsonP if url is relative to local "contact.json" ?

    Also you should show how you are using the defined store.


    "Thanks bluehipy ,
    i had remove the jsonP , but tell me the syntax of showing the defined store."

  4. #4
    Sencha User bluehipy's Avatar
    Join Date
    Mar 2010
    Location
    Romania
    Posts
    609
    Vote Rating
    26
    Answers
    66
    bluehipy will become famous soon enough bluehipy will become famous soon enough

      0  

    Default


    I was asking:

    Also you should show how you are using the defined store.
    The defined store you shown upper, I was asking for the place you are actually using it.

  5. #5
    Sencha User
    Join Date
    Jul 2012
    Posts
    17
    Vote Rating
    0
    sachinrathore is on a distinguished road

      0  

    Default


    Quote Originally Posted by bluehipy View Post
    I was asking:



    The defined store you shown upper, I was asking for the place you are actually using it.

    "Thanks bluehipy

    Below is my view : where i used my store

    Ext.define("NotesApp.view.GridContainer", {
    extend: "Ext.Container",
    alias: "widget.gridcontainer",
    initialize: function () {
    this.callParent(arguments);
    var backGrid = {
    xtype: "button",
    text: 'Back',
    ui: 'back',
    handler: this.onBackGridButtonTap,
    scope: this
    };


    var topToolbar = {
    xtype: "toolbar",
    title: 'Grid Container',
    docked: "top",
    items: [
    backGrid,
    { xtype: 'spacer' }
    ]
    };


    var gridView = {
    xtype: "grid",
    store: Ext.getStore("Grid")
    };


    this.add([topToolbar,gridView]);
    },
    onBackGridButtonTap: function () {
    console.log("backGridCommand");
    this.fireEvent("backGridCommand", this);
    },
    onNotesListDisclose: function (list, record, target, index, evt, options) {
    console.log("editWebCommand");
    this.fireEvent('editWebCommand', this, record);
    },


    config: {
    layout: {
    type: 'fit'
    }
    }
    });

    and below is my gried view:

    Ext.define('NotesApp.view.Grid', {
    extend : 'Ext.ux.touch.grid.View',
    alias: "widget.grid",
    requires : [
    'Ext.ux.touch.grid.feature.Feature',
    'Ext.ux.touch.grid.feature.Editable',
    'Ext.ux.touch.grid.feature.Sorter',
    'Ext.field.Number',
    'Ext.DataView',
    'NotesApp.store.Grid'


    ],


    config : {
    store : true,
    columns : [
    {
    header : 'UID',
    dataIndex : 'Uid',
    width : '15%',
    editor : {
    xtype : 'numberfield'
    }
    },


    {
    header: 'Notification',
    dataIndex:'Ntf',
    width : '35%',
    editor:{
    xtype:'textfield'
    }
    },
    {
    header: 'Receipt ID',
    dataIndex:'RcpntID',
    width : '25%',
    editor:{
    xtype:'textfield'
    }
    },
    {
    header: 'Date',
    dataIndex:'ntfDt',
    width : '25%',
    editor:{
    xtype:'numberfield'
    }
    }
    ],
    features : [
    {
    ftype : 'Ext.ux.touch.grid.feature.Sorter',
    launchFn : 'initialize'
    },
    {
    ftype : 'Ext.ux.touch.grid.feature.Editable',
    launchFn : 'initialize'
    }
    ]
    },
    applyStore : function() {
    return new NotesApp.store.Grid();
    }
    });


    "

  6. #6
    Sencha User bluehipy's Avatar
    Join Date
    Mar 2010
    Location
    Romania
    Posts
    609
    Vote Rating
    26
    Answers
    66
    bluehipy will become famous soon enough bluehipy will become famous soon enough

      0  

    Default


    Hm..

    var gridView = {
    xtype: "grid",
    store: Ext.getStore("Grid")
    };



    and in applyStore you say:

    return new NotesApp.store.Grid();



    I think that applyStore should be a lil different or else will never be able to set any store but the
    NotesApp.store.Grid.

    I am affaraid you are overwriting the store methods of the
    Ext.ux.touch.grid.View. Just comment out the applyStore in your sublcass and I think it will work. Just a supposition.

  7. #7
    Sencha User
    Join Date
    Jul 2012
    Posts
    17
    Vote Rating
    0
    sachinrathore is on a distinguished road

      0  

    Default


    Quote Originally Posted by bluehipy View Post
    Hm..

    var gridView = {
    xtype: "grid",
    store: Ext.getStore("Grid")
    };



    and in applyStore you say:

    return new NotesApp.store.Grid();



    I think that applyStore should be a lil different or else will never be able to set any store but the
    NotesApp.store.Grid.

    I am affaraid you are overwriting the store methods of the
    Ext.ux.touch.grid.View. Just comment out the applyStore in your sublcass and I think it will work. Just a supposition.



    "vvvv... thanks bluehipy,
    Now now my grid is populating with json as well as from web service.
    Thanksssssssssssssss"

  8. #8
    Sencha User bluehipy's Avatar
    Join Date
    Mar 2010
    Location
    Romania
    Posts
    609
    Vote Rating
    26
    Answers
    66
    bluehipy will become famous soon enough bluehipy will become famous soon enough

      0  

    Default


    Great. Pick the best answer and close the thread

Thread Participants: 1