1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    6
    Vote Rating
    0
    aprochko is on a distinguished road

      0  

    Default Unanswered: Cannot Display Data in GRID

    Unanswered: Cannot Display Data in GRID


    I am using a ASP.NET Web Service JSONP to get data from a SQL Server database. The data looks ok, however, I am unable to get it to render in the Grid. The JSON data is attached. Any help is appreciated.myJSON.jpg



    Ext.onReady(function(){
    Ext.tip.QuickTipManager.init();

    Ext.define('Authors', {
    extend: 'Ext.data.Model',
    fields: [
    {name: 'userID', type: 'int'},
    {name: 'fullName', type: 'string'},
    {name: 'userName', type: 'string'},
    {name: 'eMail', type: 'string'},
    {name: 'isActive', type: 'string'}
    ],
    idProperty: 'userID'
    });

    // create the Data Store
    var store = Ext.create('Ext.data.Store', {
    pageSize: 40,
    model: 'Authors',
    remoteSort: true,
    proxy: {
    type: 'jsonp',
    url: '../../EMRWebServices/Service.asmx/getSampleSQLDataSencha',
    // url: 'www.speechtodocs.com/EMRWebServices/Service.asmx/getSampleSQLDataSencha',
    reader: {
    totalProperty: 'd.totalCount',
    root: 'd.items'
    }
    }
    });

    // pluggable renders
    function renderEmail(value, p, record) {
    return Ext.String.format('<a href="{1}" target="_blank">{0}</a>',
    value,
    record.data.link
    );
    }

    var pluginExpanded = true;
    var grid = Ext.create('Ext.grid.Panel', {
    width: 700,
    height: 500,
    title: 'Show MTASP Authors',
    store: store,
    viewConfig: {
    trackOver: false,
    stripeRows: true
    },
    // grid columns
    columns:[{
    id: 'userid',
    text: "UserID",
    dataIndex: 'userid',
    width: 50,
    hidden: true,
    sortable: false
    },{
    text: "Author",
    dataIndex: 'fullname',
    width: 200,
    sortable: true
    },{
    text: "Username",
    dataIndex: 'username',
    width: 120,
    align: 'left',
    sortable: true
    },{
    text: "Email",
    dataIndex: 'email',
    width: 200,
    renderer: renderEmail,
    sortable: true
    },{
    text: "Active",
    dataIndex: 'isActive',
    width: 70,
    sortable: true
    }],
    // paging bar on the bottom
    bbar: Ext.create('Ext.PagingToolbar', {
    store: store,
    displayInfo: true,
    displayMsg: 'Displaying topics {0} - {1} of {2}',
    emptyMsg: "No topics to display",
    items:[
    '-', {
    text: 'Show Preview',
    pressed: pluginExpanded,
    enableToggle: true,
    toggleHandler: function(btn, pressed) {
    var preview = Ext.getCmp('gv').getPlugin('preview');
    preview.toggleExpanded(pressed);}
    }
    ]
    }),
    renderTo: 'topic-grid'
    });

    // trigger the data store load
    store.load;
    });

  2. #2
    Sencha User poojagarg89's Avatar
    Join Date
    Sep 2011
    Location
    Ahmedabad,India
    Posts
    213
    Vote Rating
    0
    poojagarg89 is on a distinguished road

      0  

    Default


    I dont have idea of ASP.NET n JSONP

    but m using Ajax request to fetch the data from the database and to display in the grid
    if u r using ajax request for getting data from DB then u can use this code:

    Code:
    Ext.define('Authors', {
            extend: 'Ext.data.Model',
            fields: [
               {name: 'userID',   type: 'int'},
               {name: 'fullName', type: 'string'},
               {name: 'userName', type: 'string'},
               {name: 'eMail',    type: 'string'},
               {name: 'isActive', type: 'string'}
            ],
            idProperty: 'userID'
        });
    var bulletin_users_store = new Ext.data.Store({
        model: 'Authors',
        proxy: {
            type: 'ajax',
            url : 'display.do', /*the name of the action class through which ur gonna show the values */
            reader: {
                type: 'xml',
                record: 'item'
            }
        }
    });
    m using struts so display.do is the path name in my struts for particular action class...........!!!

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    6
    Vote Rating
    0
    aprochko is on a distinguished road

      0  

    Default


    Thank you, but I'm looking for a solution in JSON

  4. #4
    Sencha User
    Join Date
    Nov 2011
    Posts
    17
    Vote Rating
    0
    Dragonrider is on a distinguished road

      0  

    Default


    Ext.define('Authors', { extend: 'Ext.data.Model',

    fields: [ {name: 'userID', type: 'int'},
    {name: 'fullName', type: 'string'},
    {name: 'userName', type: 'string'},
    {name: 'eMail', type: 'string'},
    {name: 'isActive', type: 'string'} ],

    idProperty: 'userID' });

    var bulletin_users_store = new Ext.data.JsonStore({
    model: 'Authors',
    proxy: {
    type: 'ajax',
    url : 'display.do', /*the name of the action class through which ur gonna show the values */
    reader: {
    type: 'json',
    record: 'item'
    }
    }
    });

    Try this one for json...

  5. #5
    Sencha User
    Join Date
    Nov 2011
    Posts
    1
    Vote Rating
    0
    EmegaMart20 is on a distinguished road

      0  

    Default


    thanks I will try it. may be my problem solved. I hope.

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar