From 19eec4188d6d871d980deee2255507ac7d265b6c Mon Sep 17 00:00:00 2001 From: Christian Klinger Date: Mon, 8 Aug 2016 14:30:18 +0200 Subject: subnet select. --- modules-available/roomplanner/clientscript.js | 64 +++++++++++++-------------- 1 file changed, 31 insertions(+), 33 deletions(-) (limited to 'modules-available/roomplanner/clientscript.js') diff --git a/modules-available/roomplanner/clientscript.js b/modules-available/roomplanner/clientscript.js index b7bd5d55..c19e63ec 100644 --- a/modules-available/roomplanner/clientscript.js +++ b/modules-available/roomplanner/clientscript.js @@ -48,37 +48,6 @@ function loadMachines(query, callback) { } -var searchSettings = { - plugins : ["remove_button"], - valueField: 'machineuuid', - searchField: "combined", - //labelField: "combined", - openOnFocus: false, - create: false, - render : { option : renderMachineEntry, item: renderMachineEntry}, - load: loadMachines, - maxItems: 1, - sortField: 'clientip', - sortDirection: 'asc', - onChange: clearSubnetBox - -} - -var subnetSettings = { - plugins : ["remove_button"], - valueField: 'machineuuid', - searchField: "combined", - //labelField: "combined", - openOnFocus: false, - create: false, - render : { option : renderMachineEntry, item: renderMachineEntry}, - load: loadMachines, - maxItems: 1, - sortField: 'clientip', - sortDirection: 'asc', - onChange: clearSearchBox - -} function clearSearchBox() { $selectizeSearch[0].selectize.setValue([], true); @@ -92,8 +61,37 @@ function initSelectize() { console.log("initializing selectize"); /* init modal */ $modal = $('#selectMachineModal'); - $selectizeSearch = $('#machineSearchBox').selectize(searchSettings); - $selectizeSubnet = $('#subnetBox').selectize(subnetSettings); + + /* for the search */ + $selectizeSearch = $('#machineSearchBox').selectize({ + plugins : ["remove_button"], + valueField: 'machineuuid', + searchField: "combined", + openOnFocus: false, + create: false, + render : { option : renderMachineEntry, item: renderMachineEntry}, + load: loadMachines, + maxItems: 1, + sortField: 'clientip', + sortDirection: 'asc', + onChange: clearSubnetBox + }); + + + /* for the subnet box */ + $selectizeSubnet = $('#subnetBox').selectize({ + options: subnetMachines, + plugins : ["remove_button"], + valueField: 'machineuuid', + searchField: "combined", + openOnFocus: true, + create: false, + render : { option : renderMachineEntry, item: renderMachineEntry}, + maxItems: 1, + sortField: 'clientip', + sortDirection: 'asc', + onChange: clearSearchBox + }); $('#selectMachineButton').on('click', onBtnSelect); -- cgit v1.2.3-55-g7522