Duplicate the combo value loaded via ajax

Hi All,

First of all, I would like to thanks all the question has been answered, the touch component works great and I believe it will be better once actual release.

I have multiple combo components which share the same id and value and may need to load once only after init, for 'SA_cboFromBranch I load the value via ajax, and I would to duplicate the same id and value to SA_cboToBranch, is there any way to do this? The reason is to reduce multiple ajax request and increase loading speed.

{ view: 'combo', label: 'Fr Branch', value: '', id: 'SA_cboFromBranch', labelWidth: '90', datatype: 'json', url: 'BranchSelector.asp'},
{ view: 'combo', label: 'To Branch', value: '', id: 'SA_cboToBranch', labelWidth: '90', datatype: 'json', url: ''},

remove “url” from configuration and use the next code after dhx.ui call

dhx.ajax(‘BranchSelector.asp’, function(response){
$$(‘SA_cboFromBranch’).parse(response);
$$(‘SA_cboToBranch’).parse(response);
});

Dear Stanislav,

wow! thanks for your quick response,

after try out, I got an error “Object don’t have method parse”. Need your help.

Sorry, was a my typo, the correct code will be

$$(‘SA_cboFromBranch_list’).parse(response);
$$(‘SA_cboToBranch_list’).parse(response);

The “_list” suffix points to the list of options related to the combo input

Dear Stanislav,

I try to append the “_list” keyword, but got the error “cannot call method ‘parse’ of undefined”,

I call this code after dhx.ui(appView); call, so the $$(‘SA_cboFromBranch’) should not be null object, right?

Hi Stanislav,

I am using multiview, and I notice that if the view is how, then the call is ok, if the either one of the view is not show yet, then I will get the error “cannot call method ‘parse’ of undefined”. Is there a way to fix this?

You can place the dhx.ajax call in onViewChange event of multiview

multiview.attachEvent("onViewChange", function(name){ if (name == "some") dhx.ajax(... })

As result the loading will start only when related view is visible.

The existing behavior is expected - as elements not render self while they are not visible ( to improve loading speed of app ), we will check how this scenario can be implemented in more neat way, and will add some related improvements in a next versions.