A user should select hosts after selecting some groups. I have build a chained select with the JQuery chained remote Plugin for selecting Hosts via Groups. The following code is being used and working fine:
$('#hosts').remoteChained({
parents: "#hosts_group",
url: "ajax/getHosts"
});
<select id="hosts_group" name="hosts_group" class="form-control">
<option value="">Bitte Gruppe selektieren</option>
<option value="1>Some Groups</option>
</select>
<select id="hosts" name="hosts"></select>
But the final result should provide a duallistbox for the Hosts in which a User can select Hosts from any Group. I have tried adding the multiple tag to the hosts select and adding a JQuery DuallistBox via the following snippet:
$('#hosts').remoteChained({
parents: "#hosts_group",
url: "ajax/getHosts"
}).DualListBox({json: false});
The duallist box is displayed fine, but no hosts are shown when I select a group.
JSON Data looks like the following:
[
{'name': 'host1', 'id': '1'},
{'name': 'host2', 'id': '2'}
]
When selecting a different group, the json contains also the different hosts. The chained select plugin requests the data via the following request: ajax/getHosts/?hosts_group=selectedId
Just using the chained select with a normal multiple select works fine. The problem is displaying the json data, which differs for each select, in the duallist box.
I have tried to build a JsFiddle example, but it is not working, because the external library won't be loaded and I don't really understand how I can manually provide the json via different selects.