Changeset 5302
- Timestamp:
- 05/27/14 21:42:29 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
SMC/trunk/SMC/src/web/scripts/js/query_input/qi.js
r3433 r5302 66 66 new_input = genAutocomplete (key, param); 67 67 break; 68 case "cql": 69 var cql_elems = genCQLInput(key, param); 70 new_input = cql_elems[0]; 71 new_widget = cql_elems[1]; 72 break; 68 73 case "link": 69 74 new_input = genLink (key, param); … … 81 86 $(new_input).data("key", key) 82 87 .addClass("type-" + param.widget) 83 .attr("id", settings.input_prefix + key)84 .data("param-object", param);85 88 .attr("id", settings.input_prefix + key) 89 .data("param-object", param); 90 86 91 if (param.widget!="link") { 87 92 // set initial valuelink … … 119 124 } 120 125 121 /**122 generate a link to current state based on the settings123 PLANNED?: accept a function reference from opts (.onmousedown)124 */125 126 function genLink(key, param_settings) { 126 127 … … 129 130 130 131 $(a).mousedown(function(e) { 131 132 133 132 $(this).attr("target", "_blank"); 133 $(this).attr("href", generateLink()); 134 }); 134 135 return a; 135 136 } … … 143 144 } 144 145 145 /** generating ou own comboboxes, because very annoying trying to use some of existing jquery plugins (easyui.combo, combobox, jquery-ui.autocomplete) */146 /** generating our own comboboxes, because very annoying trying to use some of existing jquery plugins (easyui.combo, combobox, jquery-ui.autocomplete) */ 146 147 function genCombo (key, param_settings) { 147 148 148 var select = $("<select id='widget-" + key + "' />") 149 select.attr("id", settings.input_prefix + key) 150 param_settings.values.forEach(function(v) { $(select).append("<option value='" + v +"' >" + v + "</option>") }); 149 var select = $("<select id='widget-" + key + "' />"); 150 //select.attr("id", settings.input_prefix + key) 151 152 if (param_settings.static_source) { 153 //var scanURL = settings.fcs_source + param_settings.index 154 var source_url = param_settings.static_source.replace(/&/g,'&'); 155 // if static source - try to retrieve the data 156 $.getJSON(source_url, function(data) { 157 param_settings.values = data.terms 158 param_settings.values.forEach(function(v) { $(select).append("<option value='" + v.value +"' >" + v.label + "</option>") }); 159 //console.log($(input).autocomplete().source); 160 }); 161 162 //param_settings.source = fcsScan; 163 } else if (param_settings.values) { 164 // $(input).autocomplete(param_settings); 165 if (typeof param_settings.values[0] ==='object') {// accept format with value and label 166 param_settings.values.forEach(function(v) { $(select).append("<option value='" + v.value +"' >" + v.label + "</option>") }); 167 } else { 168 param_settings.values.forEach(function(v) { $(select).append("<option value='" + v +"' >" + v + "</option>") }); 169 } 170 } else { /* if no values, rather make a textbox out of it? */ 171 //select = 172 } 173 174 select.attr("id", settings.input_prefix + key) 151 175 return select; 152 176 } … … 157 181 var input = $("<input />"); 158 182 $(input).attr("name",key) 159 183 // console.log(key, param_settings.static_source); 160 184 if (param_settings.static_source) { 161 185 //var scanURL = settings.fcs_source + param_settings.index 162 var s canURL= param_settings.static_source.replace(/&/g,'&');186 var source_url = param_settings.static_source.replace(/&/g,'&'); 163 187 // if static source - try to retrieve the data 164 $.getJSON(s canURL, function(data) {188 $.getJSON(source_url, function(data) { 165 189 param_settings.source = data.terms 166 190 $(input).autocomplete(param_settings); 167 // console.log($(input).autocomplete("option","source").length);191 //console.log($(input).autocomplete().source); 168 192 }); 169 193 … … 176 200 } 177 201 202 178 203 function fcsScan(request, response) { 179 204 response( $.ui.autocomplete.filter(
Note: See TracChangeset
for help on using the changeset viewer.