Ext. UX. Form. lovcombo. js select multiple options under ext3.4.0. When the mouse leaves, the selected project disappears.

Source: Internet
Author: User

First download lovcombo address for http://lovcombo.extjs.eu/

Extjs3.0 and this Dongdong have a bug, that is, after selection, the loss of the focus value will disappear.

Solution: Add beforeblur to Ext. UX. Form. lovcombo. js. The method is

Before the setvalue of Ext. UX. Form. lovcombo. JS, add

 

Beforeblur: function (){
Var val = This. getrawvalue ();
If (this. forceselection ){
If (Val. length> 0 & Val! = This. emptytext ){
This. El. Dom. value = ext. isdefined (this. lastselectiontext )? This. lastselectiontext :'';
This. applyemptytext ();
} Else {
This. clearvalue ();
}
} Else {
VaR texts = Val. Split (',');
VaR values = '';
For (VAR I = 0; I <texts. length; I ++ ){
VaR rec = This. findrecord (this. displayfield, texts [I]. Trim ());
If (REC ){
Values + = (values. length> 0? ',': '') + Rec. Data [This. valuefield];
}
}
This. setvalue (values );
}
}

 

You can.

The HTML code is

 

Ext. onready (function (){
Ext. quicktips. INIT ();
// Create a record type person
VaR person = ext. Data. Record. Create ([{
Name: 'value ',
Mapping: 0 // 0th elements in the array
},{
Name: 'text ',
Mapping: 1 // 1st elements in the array
}]);

// Create a data parser
VaR reader = new Ext. Data. arrayreader ({
ID: 0 // required. The array contains 0th elements as the record ID.
}, Person );
 
// Create an httpproxy proxy
 
VaR DATA = [[1, "one"], [2, "dfdfs"], [3, "gerge"], [4, "dfdsfsdf"];
VaR proxy = new Ext. Data. memoryproxy (data );
 
// Create a dataset store
VaR DS = new Ext. Data. Store ({
Autoload: True,
Proxy: proxy,
Reader: Reader
});

VaR Kp = new Ext. UX. Form. lovcombo ({
Renderto: Ext. getbody (),
Name: "inzlstus ",
Fieldlabel: "asset status ",
Store: ds,
Mode: 'local ',
Triggeraction: 'all ',
Hidetrigger: false,
Allowblank: True,
Displayfield: 'text ',
Valuefield: 'value ',
Emptytext: 'select asset category ',
Editable: false
});

 
VaR TF = new Ext. Form. textfield ({
Renderto: Ext. getbody ()
, ID: 'tf'
, Width: 300
, Selectonfocus: false
, Listeners :{
Focus: function () {This. setvalue (LCC. getvalue ());}
}
});
LCC. Render
})

 

If the image does not show the image path of its ext.ux.form.lovcombo.css modified

I forgot a key question: the CSS and JS files to be imported

 

<LINK rel = "stylesheet" type = "text/CSS" href = "CSS/ext-all.css"/>
<LINK rel = "stylesheet" type = "text/CSS" href = "JS/ajax/extjs/lovc/CSS/ext.ux.form.lovcombo.css">

<SCRIPT type = "text/JavaScript" src = "JS/ajax/extjs/EXT/adapter/ext-base.js"> </SCRIPT>
<SCRIPT type = "text/JavaScript" src = "JS/ajax/extjs/EXT/ext-all.js"> </SCRIPT>
<SCRIPT type = "text/JavaScript" src = "JS/ajax/extjs/lovc/JS/EXT. UX. Form. lovcombo. js"> </SCRIPT>


Don't forget the order!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.