PDA

View Full Version : dependent combos problem when loading form



bkraut
17 Mar 2011, 2:55 AM
Hi,

I have a form in a window where I have dependent combos.
An example: Task Form with a combo Project and another combo Requirement (dependent from Project).

Form loads ok, but the combo for Requirement is not loaded when success event on the form.getForm.load gets executed. Within success I get project uuid to load dependent requirements.

Now in the requirement combo I get uuid in the field instead of the real value, because the combo.store was not loaded before the task record was loaded in the form.

I'm attaching the screenshots and relevant code.

25197

The code:



form.getForm().load({
url: 'projects/task/uuid',
method: 'GET',
params: {
uuid: this.params.uuid
},
waitMsg:'Loading...',
success: function(action, responseData) {
var record = responseData.result.data;
if (record.project != null) {
projectRequirementChooser[0].enable();
var projectRequirementChooserStore = projectRequirementChooser[0].getStore();
var proxy = new Ext.data.HttpProxy({
restful: true,
url: 'projects/project/plan/requirement/all/byproject/' + record.project
});
Ext.apply(projectRequirementChooserStore, {
proxy: proxy
});
projectRequirementChooserStore.load();
}


Best regards

bkraut
17 Mar 2011, 7:26 AM
Is there any other option to do something like this?

steffenk
17 Mar 2011, 10:50 AM
long long time ago i did it this way :
http://www.sk-typo3.de/ExtJS-Dynamische-Comboboxen.337.0.html

bkraut
21 Mar 2011, 3:12 AM
This is ok, I already have this working, this is not a problem. The problem is to realize this within of the form success event.

When the form is loaded the combos are normally already populated, as in your case. But imagine this - I can preload projects, but not requirements as this is loaded when I already know what task will be loaded in the form. So when I know what task I have I should load just requirements that belong to the project to which my task is assigned.

Everything works, just the key should not be displayed instead of text.

Best regards,
Bojan