IE6.0 ++
Extjs3.3.1
The following code is used:
[Javascript]
/**
* YHC
*/
/**
* Paging Combobox
*/
PagingMedicalcareCbo = Ext. extend (Ext. form. ComboBox ,{
/**
* Constructor
*/
Timedelay_Slow: 2000, // 1000 ms = 1 s
Timedelay_fast: 1000, // 1000 ms = 1 s
T: null,
MyStore: null,
CurrentCboText: null, // value in the current CBO text box
Constructor: function (){
This. myStore = new Ext. data. JsonStore ({
Url: "/his/medical_care! AjaxMedicalcareCbo. action ", // url address
Root: 'root ',
IdProperty: 'linkid ',
TotalProperty: "totalProperty ",
Fields: [{name: "linkId "},
{Name: "orgCode "},
{Name: "orgName "},
{Name: "dbName "},
{Name: "serverType"}],
Listeners :{
Beforeload: this. onCboBeforeLoad,
Scope: this
}
});
//
PagingMedicalcareCbo. superclass. constructor. call (this ,{
Id: "searchCbo ",
Store: this. myStore,
Mode: "remote ",
PageSize: 5,
TriggerAction: "all ",
DisplayField: "orgName ",
// ValueField: "linkId ",
Width: 180,
ListWidth: 220,
FieldLabel: 'medical unit ',
Listeners :{
Select: this. onSelected,
Keyup: this. onKeyup,
Scope: this
}
});
},
// Set parameters
OnCboBeforeLoad: function (store, options ){
If (this. currentCboText! = Null & (typeof this. currentCboText )! = 'Undefined '){
// Carry the Organization Name
Store. baseParams = {'medicalcarevo. orgname': this. currentCboText };
} Else {
// No Parameters
Store. baseParams = {};
}
},
// Assign values after selection
OnSelected: function (combo, record, index ){
Var orgName = this. myStore. getAt (index). get ('orgname ');
// This. value = orgName;
Alert (this. myStore. getAt (index). get ('orgname '));
},
// When the keyboard pops up, the current text value is assigned.
OnKeyup: function (combo, e ){
This. currentCboText = Ext. getCmp ('searchcbo'). getValue ();
// Remember to clear (very important) the next time you need to clear the last time
If (this. t ){
Window. clearInterval (this. t); // clear delayed execution
}
// If the user deletes the value of the text box (that is, there is no value)
If (this. currentCboText = ''){
This. t = window. setInterval ('ext. getCmp ("searchCbo"). myStoreLoadData () ', this. timedelay_fast );
Return;
}
// Delayed execution to avoid too fast user input, resulting in an increase in the number of access servers, Saving Performance
This. t = window. setInterval ('ext. getCmp ("searchCbo"). myStoreLoadData () ', this. timedelay_Slow );
},
// -- MyStore reloads data
MyStoreLoadData: function (){
// Reload data
This. myStore. load ({
Params: {start: 0, limit: 5}
});
// Remember to clear (important)
If (this. t! = Null ){
Window. clearInterval (this. t); // clear delayed execution
}
}
});
/**
* YHC
*/
/**
* Paging Combobox
*/
PagingMedicalcareCbo = Ext. extend (Ext. form. ComboBox ,{
/**
* Constructor
*/
Timedelay_Slow: 2000, // 1000 ms = 1 s
Timedelay_fast: 1000, // 1000 ms = 1 s
T: null,
MyStore: null,
CurrentCboText: null, // value in the current CBO text box
Constructor: function (){
This. myStore = new Ext. data. JsonStore ({
Url: "/his/medical_care! AjaxMedicalcareCbo. action ", // url address
Root: 'root ',
IdProperty: 'linkid ',
TotalProperty: "totalProperty ",
Fields: [{name: "linkId "},
{Name: "orgCode "},
{Name: "orgName "},
{Name: "dbName "},
{Name: "serverType"}],
Listeners :{
Beforeload: this. onCboBeforeLoad,
Scope: this
}
});
//
PagingMedicalcareCbo. superclass. constructor. call (this ,{
Id: "searchCbo ",
Store: this. myStore,
Mode: "remote ",
PageSize: 5,
TriggerAction: "all ",
DisplayField: "orgName ",
// ValueField: "linkId ",
Width: 180,
ListWidth: 220,
FieldLabel: 'medical unit ',
Listeners :{
Select: this. onSelected,
Keyup: this. onKeyup,
Scope: this
}
});
},
// Set parameters
OnCboBeforeLoad: function (store, options ){
If (this. currentCboText! = Null & (typeof this. currentCboText )! = 'Undefined '){
// Carry the Organization Name
Store. baseParams = {'medicalcarevo. orgname': this. currentCboText };
} Else {
// No Parameters
Store. baseParams = {};
}
},
// Assign values after selection
OnSelected: function (combo, record, index ){
Var orgName = this. myStore. getAt (index). get ('orgname ');
// This. value = orgName;
Alert (this. myStore. getAt (index). get ('orgname '));
},
// When the keyboard pops up, the current text value is assigned.
OnKeyup: function (combo, e ){
This. currentCboText = Ext. getCmp ('searchcbo'). getValue ();
// Remember to clear (very important) the next time you need to clear the last time
If (this. t ){
Window. clearInterval (this. t); // clear delayed execution
}
// If the user deletes the value of the text box (that is, there is no value)
If (this. currentCboText = ''){
This. t = window. setInterval ('ext. getCmp ("searchCbo"). myStoreLoadData () ', this. timedelay_fast );
Return;
}
// Delayed execution to avoid too fast user input, resulting in an increase in the number of access servers, Saving Performance
This. t = window. setInterval ('ext. getCmp ("searchCbo"). myStoreLoadData () ', this. timedelay_Slow );
},
// -- MyStore reloads data
MyStoreLoadData: function (){
// Reload data
This. myStore. load ({
Params: {start: 0, limit: 5}
});
// Remember to clear (important)
If (this. t! = Null ){
Window. clearInterval (this. t); // clear delayed execution
}
}
});
Use a string to call latency:
[Javascript] this. t = window. setInterval ('ext. getCmp ("searchCbo"). myStoreLoadData () ', this. timedelay_Slow );
This. t = window. setInterval ('ext. getCmp ("searchCbo "). myStoreLoadData () ', this. timedelay_Slow); remember to use Ext instead of this. method Name (incorrect). The correct method is described above.
You must use a string before calling the API. Otherwise, the API cannot be called. Remember to use a string ....
From yhc13429826359