1. #1
    zhiliang
    Guest

    Default Builder classes/Preconfigured Classes

    Builder classes/Preconfigured Classes


    hello everyone, i have a problem when i want to configure classes,

    for example, i create a class extends from combobox


    PHP Code:
        var releasestore = new Ext.data.Store({
               
    proxy: new Ext.data.HttpProxy({
               
    url'./php/backend.php',
                
    method'POST'
            
    }),
            
    baseParams:{task"showRelease"},
            
    reader:  new Ext.data.JsonReader({
                
    root'release'
                
    //root: 'results', 
                //totalProperty: 'total'
            
    }, [
                {
    name'appli'mapping 'Appli'},
                {
    name'release'mapping 'IdRelease'}   
                ])
        });
        
        
    Application.ComboRelease Ext.extend(Ext.form.ComboBox, {
         
    border:false
        
    ,initComponent:function() {      
            
    Ext.apply(this, {
            
    storereleasestore,
            
    displayField:'release',
            
    typeAheadtrue,
            
    //mode: 'local',
            
    triggerAction'all',
            
    emptyText:'Release',
            
    fieldLabel:'Release',
            
    selectOnFocus:true,
            
    width:100
            
    });
     
            
    Application.ComboRelease.superclass.initComponent.apply(thisarguments);
        } 
     
        ,
    onRender:function() {
            
            
    Application.ComboRelease.superclass.onRender.apply(thisarguments);
        } 
        });
     
        
    Ext.reg('ComboRelease'Application.ComboRelease); 
    it works well when i add to the panel , but in another function i need the selected value from this combobox,

    function PDFClick(btn){

    var item = ComboRelease.getValue();
    }

    then it will create an error, "ComboRelease not defined", so how can i use the classes i defined??


    the same problem when i create a toolbar, how can i use this function Mytoolbar.addField(comboPDFTpye);

    PHP Code:
    Application.Mytoolbar Ext.extend(Ext.Toolbar, {
       
        
    initComponent:function() {      
            
    Ext.apply(this, {
           
            });
     
            
    Application.Mytoolbar.superclass.initComponent.apply(thisarguments);
        } 
     
        ,
    onRender:function() {

            
    Application.Mytoolbar.superclass.onRender.apply(thisarguments);
        } 
        });
     
        
    Ext.reg('Mytoolbar'Application.Mytoolbar);



       
    Mytoolbar.addField(comboPDFTpye);

       
    Mytoolbar.add(
            {
            
    text'PDF',
            
    enableToggletrue,
            
    toggleHandlerPDFClick,
            
    pressedtrue
          
    }); 
    I am a beginner, really hope someone can help, thanks

  2. #2
    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


    You need to work with an instance of the class, not on the class itself.

    releasestore is a reference to an instance of a data.store class for example.
    You need to define an instance of Application.ComboRelease.

    PHP Code:
    var myComboRelease = new Application.ComboRelease(
       {
          
    //specify any overrides or required configs for your extension (if any)
       
    }
    );

    function 
    PDFClick(btn){
       var 
    item myComboRelease.getValue(); 


  3. #3
    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


    Are you working with Ext1? Would be better to work with Ext2, you posted in Ext 1 forum.

  4. #4
    zhiliang
    Guest

    Default


    really thanks sorry i post the wrong place, i use ext 2.x, now i understand how to use the builder classes

Thread Participants: 1