1. #1
    Ext User r2k's Avatar
    Join Date
    Aug 2007
    Posts
    67
    Vote Rating
    0
    r2k is on a distinguished road

      0  

    Default about how to add data to Form + grid

    about how to add data to Form + grid


    ok, i'll tell a short history about what am i doing ...

    i need to load data from XML
    HTML Code:
    <rows>
       <data name='' value='' />
       .....
    <rows>
    and because i have a window with tab pannel i used a formpanel in tab 1 and a grid panel in the second tab
    i'm loading part of the data into the form panel and the rest on the grid panel....

    ok... i begin loading the data with a Datastore (XMLReader/HttpProxy) and later using the load listener to fill the data into the formpanel and later calling LoadData(oData, bAppend) to fill the DataStore (ArrayReader/MemoryProxy) using the data from the first datastore to load the seccond APPEDING the adquired data.

    everything appears to flowing perfectly but i can't make that the fields update the values when the new data is adquired ... debugging with firefox apparently i'm doing fine ... but really i don't know whats is really happening ...

    Code:
    store	: new Ext.data.Store({
        proxy		: new Ext.data.HttpProxy({url : 'datos/detObjeto.asp'}),
        id			: 'nombre',
        reader		: new Ext.data.XmlReader({
            record		: 'data',
            id			: '@name'
            },
            [{name: 'tname', mapping: '@name'},
            {name: 'tvalue', mapping: '@value'}]
        ),
        listeners	:{
            'load'	: function(	oDts, oRecs, oOpts){
                var cont;
                  for(cont=0;cont < oRecs.length;cont++ ){
                    if(oRecs[cont].get('tname') == 'XXXX'){
                        Ext.getCmp('txtXXXX').value=oRecs[cont].get('tvalue');
                        continue;
                    }// Code to update the field value
                      Ext.getCmp('grdXXXX').store.loadData(oRecs[cont].data,true);// Code to fill the grid					
                  }
    The question is ...

    thius is the best way to update the data into the form components ? ....

    if need more details say it
    [extjs 2.2]
    [Browsers: IE(6/7/8), FF (3.0.8), chrome 2.0]

  2. #2
    Sencha User
    Join Date
    Mar 2007
    Posts
    61
    Vote Rating
    0
    greyknght1 is on a distinguished road

      0  

    Default


    I am not going to write it out for you exactly but this is what I did.
    profileName.setValue(obj.getAt(r).get('profileName'));

    profileName is the name of the profileName text field. r= the record, and profileName is the datastore reader value for the data element ({name: 'profileName', mapping: 'profileName', type: 'string'} as you can see.)

    I am sure that there might be a better way to take data from a datastore and place it into fields, but this seems to work rock solid for me. Have fun!

    Mike

  3. #3
    Ext User r2k's Avatar
    Join Date
    Aug 2007
    Posts
    67
    Vote Rating
    0
    r2k is on a distinguished road

      0  

    Default


    i will try that but what about the method used to fill teh grid
    [extjs 2.2]
    [Browsers: IE(6/7/8), FF (3.0.8), chrome 2.0]

  4. #4
    Ext User zhegwood's Avatar
    Join Date
    Dec 2007
    Location
    Boulder, CO Suburbia (Lafayette)
    Posts
    388
    Vote Rating
    1
    zhegwood is on a distinguished road

      0  

    Default


    Quote Originally Posted by r2k View Post
    i will try that but what about the method used to fill teh grid
    The grid will update when the store's data is updated... In order to update the information, you'll commit the changes.
    Code:
    store.commitChanges()

  5. #5
    Ext User r2k's Avatar
    Join Date
    Aug 2007
    Posts
    67
    Vote Rating
    0
    r2k is on a distinguished road

      0  

    Default


    HI ty for the reply,

    my field finally update
    i did this
    Code:
    Ext.getCmp('tpZZZ').form.findField("txtXXX").setValue(oRecs[cont].get('tvalue'));
    instead of :
    Code:
    Ext.getCmp('txtXXXX').value=oRecs[cont].get('tvalue');
    but i'm not having any succes loading the grid with my new data
    Code:
    Ext.getCmp('grdXXXX').store.removeAll();
    Ext.getCmp('grdXXXX').store.loadData(oRecs[cont].data,true);
    Ext.getCmp('grdXXXX').store.commitChanges();
    any ideas about how can i load the data ?

    This is how i declared my grid (panel)
    Code:
    {
        title	: '...',
        xtype	: 'grid',
        id		: 'grdXXXX',
        store	: new Ext.data.Store({
                proxy		: new Ext.data.MemoryProxy([]),
                id			: 'dtsExtra',
                reader		: new Ext.data.ArrayReader({},[{name: 'tname'},{name: 'tvalue'}])
        }),
        columns: [
            {header: "Property", width: 200, sortable: true, dataIndex: 'tname'},
            {header: "Value", width: 120, sortable: true, dataIndex: 'tvalue'}
        ],
        viewConfig: {
            forceFit: true
        }
    }
    [extjs 2.2]
    [Browsers: IE(6/7/8), FF (3.0.8), chrome 2.0]

  6. #6
    Sencha User fay's Avatar
    Join Date
    Apr 2007
    Location
    Ireland
    Posts
    1,750
    Vote Rating
    7
    fay will become famous soon enough fay will become famous soon enough

      0  

    Default


    If oRecs[cont].data is valid, I think that all you should have to do is:

    PHP Code:
    Ext.getCmp('grdXXXX').store.loadData(oRecs[cont].datafalse);
    Ext.getCmp('grdXXXX').getView().refresh(); 

  7. #7
    Ext User r2k's Avatar
    Join Date
    Aug 2007
    Posts
    67
    Vote Rating
    0
    r2k is on a distinguished road

      0  

    Default


    ok. I updated the gridview but now i have an scope problem.... :S

    firebug says:
    Code:
    Ext.getCmp('grdXXXX').getView().refresh(); <------ Error on this line
    ----------------------------
    this.grid is undefined http://.../extjs/ext-all.js Line 144
    any ideas .... ¿?
    [extjs 2.2]
    [Browsers: IE(6/7/8), FF (3.0.8), chrome 2.0]

  8. #8

  9. #9
    Ext User r2k's Avatar
    Join Date
    Aug 2007
    Posts
    67
    Vote Rating
    0
    r2k is on a distinguished road

      0  

    Default


    oops shame!!! ...

    ok in this line

    extjs-all-debug.js
    Code:
    31590 refresh : function(headersToo){
    31591      this.fireEvent("beforerefresh", this);
    31592      this.grid.stopEditing(true); //<---- ERROR!!!!!!! 
    31593
    31594       var result = this.renderBody();
    31595       this.mainBody.update(result);
    31596
    31597       if(headersToo === true){
    31598             this.updateHeaders();
    31599             this.updateHeaderSortState();
    31600       }
    31601       this.processRows(0, true);
    31602       this.layout();
    31603       this.applyEmptyText();
    31604       this.fireEvent("refresh", this);
    31605 }
    FYI - not develop too much in extjs currently making test on it
    [extjs 2.2]
    [Browsers: IE(6/7/8), FF (3.0.8), chrome 2.0]

  10. #10
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    5
    mjlecomte will become famous soon enough mjlecomte will become famous soon enough

      0  

    Default


    I'd suggest reposting your latest code. Can't quite get where you're at now.

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