Extjs combobox paging Query

Source: Internet
Author: User

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

Related Article

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.