PDA

View Full Version : dialog with lazy init doesn't work



kallou
6 Aug 2007, 7:52 AM
hello,
i extended the combobox widget to add this autocomplete functionnality, base on the twin trigger field, when i click on the "magnifier" trigger i want a dialog to be opened , so the user may have more choice in the fields to find the datas he is looking for.
(take a look at the attached screenshots).

here the code to inits these fields, basically i build a config objet, build a datastore, build a extended combobox with the store and and the config then render it.

[CODE]
/**
* ==============================================
* ==============================================
* ==============================================
* searchPopup
* ==============================================
* ==============================================
* ==============================================
*/
var cfgSP = {
// quelle url permet de retrouver le resultat de la recherche
url:'struts/do/Commun/PopupRechercheAction',


// parametres url pour recherche
urlParams:{
// parametres de base
baseParams:{
liste:'LST_CLIENTS_ACTIFS', // liste des clients
'param(actif)':'true' // actif
}
},

// message attent cibl

kallou
7 Aug 2007, 12:24 AM
i dont know why but if in the extend function of a object you declare something like this



Ext.extend(Ext.custom.searchPopup, Ext.form.ComboBox, {
dialog:{
obj1:null,
obj2:null,
obj3:[],
}
...
showdialog: function(){
if (this.dialog.dlg){
... fragement code to create the dialog ...
}
}
}


then if you init severals objects of type Ext.custom.searchPopup like :


var cb1 = new Ext.custom.searchPopup(config1);
var cb2 = new Ext.custom.searchPopup(config2);


all your Ext.custom.searchPopup objects will share the same this.dialog instance!!!

for solved this you just have to write :


Ext.extend(Ext.custom.searchPopup, Ext.form.ComboBox, {
dialog:null, simple local object
...
...
showdialog: function(){
if (this.dialog){
// add properties to your object to reflect your structural view
this.dialog.dlg = new Ext.BasiDialog(...);
}
}
}


et voil