PDA

View Full Version : [CLOSED] Best Way to Extend a ComboBox inherited Control



sisa
Apr 11, 2013, 3:13 PM
Good Afternoon all

I wrote my first ComboBox implementation. The function is quite simple, enter a ZIP code and display the Zip Code formatted as '{ZIP} - {CITY}'.
Works fine so far. The Search looks link your Example http://examples2.ext.net/#/Form/ComboBox/Custom_Search/.

Now my problem.

-> I want to set the Value 'ZIP' and call the Service to grab the CITY from the Database. This Function must be available from Code Behind and also from JS.

I await this things to be done after calling the Method :


The displayed Text should look as described above.
The Value of the ComboBox should set to a value I receive from my Service Method (basically the RecordID of the City found in the DB)


What's the best approach to solve this Problem, what do you think ?

Peter

Daniil
Apr 11, 2013, 4:27 PM
Hi Peter,

I would implement a JavaScript function like:

function setZip (zip) {
var comboBox = this; // the setZip function belongs to a custom ComboBox class

comboBox.getStore().load({
params: {
zip: zip // you should take it into account in a WebService to return respective data
},
callback: function () {
comboBox.setValue(zip);
}
})
}

Then you can implement a method for a server ComboBox class to invoke the setZip method.