Ignore:
Timestamp:
08/31/11 16:51:42 (13 years ago)
Author:
vmipsl
Message:

Interface _ plusieurs graphs possible sur le même quicklook

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ether_megapoli/trunk/web/resources/js/Select.js

    r131 r172  
    33// Display a Select 
    44// 
    5 // obj objParam: {id, [parent], [specificClass], [maxOptionSize], [isDisable], [isDisplayed], [arrayData]} 
     5// obj objParam: {id, [parent], [specificClass], [maxOptionSize], [isDisable], [isDisplayed]} 
    66//    int objParam.id: id of the dom element 
    77//    [dom objParam.parent]: in which dom element to draw the button 
     
    1010//    [int objParam.isDisable]: is the Select disable by default? 
    1111//    [int objParam.isDisplayed]: is the Select opened by default? 
    12 //    [arr objParam.arrayData]: array of data to display 
    1312// 
    1413// Public functions 
     
    3837        this.indexOption = 0; 
    3938        this.isHover = false; 
    40         this.arrayData = objectParameter.arrayData ? objectParameter.arrayData : $A(); 
    4139        this.arrayOptions = $A(); 
     40        this.className = objectParameter.className ? "select_container " + objectParameter.className : "select_container"; 
     41        this.classNameOption = objectParameter.classNameOption ? "select_choicelist " + objectParameter.classNameOption : "select_choicelist"; 
    4242 
    4343        // Select div 
    4444        this.divSelect = document.createElement( "div" ); 
    4545        this.divSelect.id = this.id; 
    46         this.divSelect.className = "select_container"; 
     46        this.divSelect.className = this.className; 
    4747 
    4848        this.divSelectLeft = document.createElement( "div" ); 
     
    6363        this.divOption = document.createElement( "div" ); 
    6464        this.divSelect.id = this.id; 
    65         this.divOption.className = "select_choicelist"; 
     65        this.divOption.className = this.classNameOption; 
    6666        this.parent.appendChild( this.divOption ); 
    6767 
     
    9090    }, 
    9191 
     92    getSize: function() 
     93    { 
     94      return this.arrayOptions.size(); 
     95    }, 
     96 
    9297    // private 
    9398    toggleOption:function() 
     
    139144 
    140145    // public 
     146    /** 
     147     * This method indicates if the itemValue is already in the array 
     148     */ 
     149    content: function( itemValue ) 
     150    { 
     151        var resu = false; 
     152        this.arrayOptions.each( function( divOption ) 
     153        { 
     154            if( divOption.itemValue == itemValue ) 
     155            { 
     156                resu = true; 
     157                throw $break; 
     158            } 
     159        }.bind( this ) ); 
     160        return resu; 
     161    }, 
     162 
     163    // public 
    141164    add: function( itemValue, itemName, callback ) 
    142165    { 
    143  
    144166        var divOption = document.createElement( "div" ); 
    145167        divOption.className = "select_item_middle"; 
     
    177199            this.arrayOptions = this.arrayOptions.without( divOption ); 
    178200        }.bind( this ) ); 
     201    }, 
     202 
     203    // public 
     204    /** 
     205     * This method changes only the content of the divSelect without add the item to the array 
     206     * @param itemValue 
     207     * @param itemName 
     208     * @param callback 
     209     */ 
     210    changeSelectMiddle: function( itemValue, itemName, callback ) 
     211    { 
     212        this.add( itemValue, itemName, callback ); 
     213        this.select( itemValue, callback ); 
     214        this.remove( itemValue ); 
    179215    }, 
    180216 
Note: See TracChangeset for help on using the changeset viewer.