Ext sencha grid with datasource

 Extjs grid con  datasource reader json example,ejemplo
Ext sencha grid with datasource
 
Ext.onReady(function()
{
  Ext.QuickTips.init();
 
 // ----------------
 // vars
 // ----------------
 var ds; // datasource var
 
 // ----------------
 // Create datasource
 // ----------------
 function createDS()
 {
  ds = new Ext.data.Store({
         proxy: new Ext.data.HttpProxy({
             url: 'search.php', // serverside script to post to
             method: 'POST' // method of posting .. GET or POST .. I've used POST
         }),
 
         // the reader
            reader:  new Ext.data.JsonReader({
    totalProperty: 'total',
    root: 'results', // the object wich old the records
    id: 'id', // the fieldname wich hold the id ... optional
    fields: ['id','name','email','comments'] // the fields the reader need to render 
   })         
 
  });    
 }
 
 createDS();     
});

Comentarios

Entradas populares de este blog

how add a listener to a grid extjs

Set BackgroundImage of a Panel