1. #1
    Sencha User
    Join Date
    Feb 2011
    Posts
    2
    Vote Rating
    0
    thiago.andrade is on a distinguished road

      0  

    Question Help Getting data From DB

    Help Getting data From DB


    Hi Guys,
    No need to say that im new using EXTJS (first post ).
    Im having issues getting this example: http://www.foscode.com/populate-extjs-mysql-datastore/ to work. I Did the PHP page (myDBConnection.php) and, if i run it alone on the page, i get this result from my DB table :
    {"myInventory":[{"nome":"Joao Silva da Souza de Almeida"},{"nome":"Maria Alvarenga"},{"nome":"Silvia Santos"},{"nome":"Fernando Fernandes"},{"nome":"Joaquina de Abreu"}],"totalCount":5}
    Is that correct?
    Assumig it is a good-to-go result, i did the next step that was using this on the js file. It is like this:
    Code:
    Ext.onReady(function(){
    
         var ds = new Ext.data.GroupingStore({
                proxy: new Ext.data.HttpProxy({
                      url:'myDBConnection.php'
                }),
                reader: new Ext.data.JsonReader({
                    id: 'Completion_ID', // no need to change it right?
                    totalProperty: 'totalCount',
                    root: "myInventory",
                    fields:
                    [{name: 'name', type: 'string', mapping: 'name'}] //only getting the name to see if it works
                     })
         
            });
    
    
        var mycolModel = new Ext.grid.ColumnModel({
          columns: [
                    {header: 'name', width:70, dataIndex: 'name'}
                   ]
        });
         
         // trigger the data store load
          ds.load({params:{start:0, limit:1000}});
         
        //Now our grid
        var grid = new Ext.grid.EditorGridPanel({
                store: ds ,
                stripeRows: true,
            width: 630,
            height:315,
                autoSizeGrid: false,
                title:'PM Status (Current Quarter)',
                collapsible: false,
                animCollapse: false
                cm: mycolModel,
                selModel: new Ext.grid.RowSelectionModel(),
                viewConfig: {
                forceFit: true
            }
         
        });
        grid.render('grid-example'); 
    };
    Whats is wrong with this scenario? i just then insert this name on the div at the HTML and it does not get anything back.

    Hoping you guys can help me.

    Thanks!

  2. #2
    Sencha - Services Team arthurakay's Avatar
    Join Date
    Sep 2008
    Location
    Antioch, IL
    Posts
    1,363
    Vote Rating
    33
    arthurakay is a jewel in the rough arthurakay is a jewel in the rough arthurakay is a jewel in the rough

      0  

    Default


    My initial thought is that your JSON result has a record property of "nome", and your grid's column model/store are looking for "name".
    Arthur Kay
    Developer Relations Manager, Sencha Inc.

    Twitter | Sencha Chicago User Group

  3. #3
    Sencha User
    Join Date
    Feb 2011
    Posts
    2
    Vote Rating
    0
    thiago.andrade is on a distinguished road

      0  

    Default


    Yeah... i figured that i needed a IDE to program.
    I found lots of errors on the code and on the naming. One of them is the one that you pointed.
    Im using Aptana to program now.

    By the way, my Aptana is now showing php files correctly... it shows then just like a Notepad would.
    Anyone have a guess why am able to see it formated?

    Thanks guys!

Similar Threads

  1. Ext.data.TreeStore with Ext.data.LocalStorageProxy and Ext.data.ScriptTagProxy
    By agruenen in forum Sencha Touch 1.x: Discussion
    Replies: 1
    Last Post: 16 Feb 2011, 11:21 PM
  2. Replies: 1
    Last Post: 20 Aug 2010, 10:34 PM
  3. Replies: 0
    Last Post: 20 Apr 2010, 12:23 PM
  4. after update data,grid select data is old data
    By ht8206 in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 25 Oct 2007, 10:39 PM

Thread Participants: 1

Tags for this Thread