placeholder for select2
This commit is contained in:
		
							
								
								
									
										17
									
								
								src/inputs/select2/select2.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								src/inputs/select2/select2.js
									
									
									
									
										vendored
									
									
								
							@@ -1,17 +1,21 @@
 | 
				
			|||||||
/**
 | 
					/**
 | 
				
			||||||
Select2 input. Based on amazing work of Igor Vaynberg https://github.com/ivaynberg/select2.  
 | 
					Select2 input. Based on amazing work of Igor Vaynberg https://github.com/ivaynberg/select2.  
 | 
				
			||||||
Please see [original docs](http://ivaynberg.github.com/select2) for detailed description and options.  
 | 
					Please see [original select2 docs](http://ivaynberg.github.com/select2) for detailed description and options.  
 | 
				
			||||||
You should manually include select2 distributive:  
 | 
					Compatible **select2 version is 3.4.1**!   
 | 
				
			||||||
 | 
					You should manually download and include select2 distributive:  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <link href="select2/select2.css" rel="stylesheet" type="text/css"></link>  
 | 
					    <link href="select2/select2.css" rel="stylesheet" type="text/css"></link>  
 | 
				
			||||||
    <script src="select2/select2.js"></script>  
 | 
					    <script src="select2/select2.js"></script>  
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
To make it **Bootstrap-styled** you can use css from [here](https://github.com/t0m/select2-bootstrap-css): 
 | 
					To make it **bootstrap-styled** you can use css from [here](https://github.com/t0m/select2-bootstrap-css): 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <link href="select2-bootstrap.css" rel="stylesheet" type="text/css"></link>    
 | 
					    <link href="select2-bootstrap.css" rel="stylesheet" type="text/css"></link>    
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
**Note:** currently `autotext` feature does not work for select2 with `ajax` remote source.    
 | 
					**Note:** currently `autotext` feature does not work for select2 with `ajax` remote source.    
 | 
				
			||||||
You need initially put both `data-value` and element's text youself.    
 | 
					You need initially put both `data-value` and element's text youself:    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <a href="#" data-type="select2" data-value="1">Text1</a>
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
@class select2
 | 
					@class select2
 | 
				
			||||||
@extends abstractinput
 | 
					@extends abstractinput
 | 
				
			||||||
@@ -44,6 +48,11 @@ $(function(){
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        this.sourceData = null;
 | 
					        this.sourceData = null;
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
					        //placeholder
 | 
				
			||||||
 | 
					        if(options.placeholder) {
 | 
				
			||||||
 | 
					            options.select2.placeholder = options.placeholder;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					       
 | 
				
			||||||
        //if not `tags` mode, use source
 | 
					        //if not `tags` mode, use source
 | 
				
			||||||
        if(!options.select2.tags && options.source) {
 | 
					        if(!options.select2.tags && options.source) {
 | 
				
			||||||
            var source = options.source;
 | 
					            var source = options.source;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user