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

      0  

    Default problem with GridPanel

    problem with GridPanel


    Hi all,
    I've a little bit problem with this code (I'm using extjs 3.2.1) :

    Code:
    var groupStore = new Ext.data.JsonStore({
    	baseParams: '',
    	method: 'POST',
    	url: 'http://127.0.0.1/index.php/ctrlpanel/getGroups;',
    	root: 'results',
    	fields: [ 'gid', 'groupname', 'accesslevel', 'groupdesc' ],
    });
    Code:
     
    var groupGrid = new Ext.grid.GridPanel({
    	store: groupStore,
    	selModel: new Ext.grid.RowSelectionModel({singleSelect:false}),
    	loadMask: true,
    	border: false,
    	autoload: true,
    
    
    	columns: [
    		new Ext.grid.RowNumberer(),
    		{ id: 'gid', header: "GID", dataIndex: 'gid', width: 25 },
    		{ header: "Name", dataIndex: 'groupname'/*, width: '40%'*/ },
    		{ header: "AccessLevel", dataIndex: 'accesslevel', /*width: '60%',*/ menuDisabled: true },
    		{ id: 'description-col', header: "Description", dataIndex: 'groupdesc', /*width: '60%',*/ menuDisabled: true }
    	],
    	defaults: {
    		sortable: true,
    		menuDisabled: false
    	},
    	viewConfig: {
    		forceFit:true
    	},
    });
    I think the problem is that I don't display any data because I don't call groupGrid.load() . But other examples I saw the groupGrid.load() called first of groupGrid in onReady() method i.e.:

    Code:
     
    groupStore.load();
    var groupGrid = new Ext.grid.GridPanel({
    ....
    )}
    but I have to call groupStore.load() inside groupGrid = new Ext.grid.GridPanel({.. HERE..});

    how can i do ?

  2. #2
    Sencha User brittongr's Avatar
    Join Date
    Jun 2007
    Location
    Panama
    Posts
    109
    Vote Rating
    3
    brittongr is on a distinguished road

      0  

    Default


    autoLoad is intended for this:

    autoLoad : Object/String/Function
    A valid url spec according to the Updater Ext.Updater.update method. If autoLoad is not null, the panel will attempt to load its contents immediately upon render.
    The URL will become the default URL for this panel's body element, so it may be refreshed at any time.

    So basically, you load content of another url inside the panel, note that autoLoad is inherited...

    If what you want is to set store autoLoad then move that config option to the store.

    You can call store.load(); before or after instantiate the gridPanel, but if you set autoLoad: true on store you don't need to call explicitly store.load...
    Greivin Britton

    My Extensions:
    Ext.ux.NumericField: Number field with support for currencySymbol, thousand separator, international...
    Ext.ux.PagerSizeSelector: A plugin that allows the change page size with just one click.
    Ext.ux.FieldAccess: A plugin to let the user know which fields are editable.

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Posts
    7
    Vote Rating
    0
    software_Engineer is on a distinguished road

      0  

    Wink [SOLVED] problem with GridPanel

    [SOLVED] problem with GridPanel


    Thanks,
    I've solved. there were two problems :
    1)the "method" it were "GET" Altough i've setted to POST in the userStore, I've setted it after userStore definition.

    Code:
    var userStore = new Ext.data.JsonStore({
        baseParams: '',
        url: 'http://blabalbla.......',
        totalProperty: 'totalCount',
        root: 'results',
        id: 'uid',
        fields: [ 'uid', 'username', 'gid', 'email', 'password' ]
    });
    userStore.proxy.conn.method = 'POST'; // <--------
    2) I had to add the listener function "render" in order to "load" the data.

    Code:
    listeners:{
         render:function(grid){
                grid.store.load(); 
         }
    }
    bye.

Thread Participants: 1

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