I'm using Qooxdoo 2.0 ComboBox and SelectBox component.
I'm looking for a solution to programmatically define the label of each combo entry.
Something similar to the labelFunction or labelField properties in the Flex ComboBox *(or spark DropDownList) componenent.
Thanks
Davide
I am not quite sure what your looking for but the data binding controller might be the stuff you need. Just check out the following demo [1] which shows a select box bound to an array containing strings. The select boxes can be replaced by combo boxes as well.
[1] http://demo.qooxdoo.org/current/demobrowser/#data~SelectBox.html
I wanted to populate the ComboBox, or SelectBox, with a list ob object with 2 properties, and then set the Combobox to use the first properties as the label and the second one as value.
A the end I used the model property from the the qx.ui.form.ListItem class. to store additional data for each selection.
This is how I populate the ComboBox item.
for(var x in data){
var tempItem = new qx.ui.form.ListItem(data[x]["name"]);
tempItem.model=data[x];
combo.add(tempItem);
}
And this is How I get the additional values from the selection:
combobox.getSelection()[0].model.id
Davide
Related
I'm currently using the most up-to-date version of Select2. The select2 box is used to display a list of skills. I am trying to set the default values (for when it's opened) to contain the current skills. I have the information in proper format, I just cannot understand how to set it. The closest I've gotten is using:
//b is array containing list of user selected options
//#e1 is select2 id
for($i=0;$i<b.length;$i++) $('#e1').val(b[$i]).trigger("change");
However, this only displays the LAST option. Which I think is because I'm not allowed to set it in a loop. However I'm unsure how else to do it??
Any current solutions are invalid as of Select v2.4.0 as initSelection and .select2("val", data etc.) was removed.
Any help is appreciated.
My solution was actually very simple and avoided for loops all together.
$('#e1').select2({
//info
}).val(b).trigger("change");
val() in jQuery also accepts arrays.
I am trying to show the names of few detectors in a combobox using d3.js. I used the following code to show the data.
d3.csv("Results_New.txt", function(data) {
//var data = d3.csv.parseRows(datatext);
d3.select("#road").selectAll("option")
.data(data).enter().append("option").text(function(d){return d.detector-id;}).attr("value",function(d){return d.detector-id;});
But the values are not being shown in the output combobox. Rather the combox options are showing blank space. Can anyone give me the idea how can the values be shown? Is it mandatory to put the combobox within a SVG?
I'm guessing your column in your csv file is named "detector-id"?
d.detector-id is not valid. That's translated as object variable d with property detector minus variable id.
Use return d["detector-id"]; instead.
Here's working code.
Is it mandatory to put the combobox within a SVG?
You actually aren't putting a combobox box in SVG. What I think you mean is "is it mandatory to build the combobox with d3?" The answer is no.
I am using SugarCRM 6.5.17 CE version. I have created a custom dropdown field which has values like amount, inquiry, total and according to selected option I want to populate a custom textarea field with different messages e.g. messages like Hello, Hi and Bye. I am confused here, so please help me out soon
Use javascript to fetch the value from the dropdown list. Set different text in the textfield depending on the value in the dropdown. jQuery is loaded in all Sugar views by default in version 6.5.x.
A javascript file can be included in a quickcreateview, detailview or editview by adding the array key includes inside the form sub array.
'includes'=> array(
array('file'=>'custom/modules/Accounts/CustomAccount.js'),
),
Trying to create a set of select options from a simple list, instead of an array or an object that would have keys. All the docs & examples I find are pertaining to keyed data types.
$scope.numbers = ['tweedle', 'beetle', 'battle'];
Using the code below, the select list renders fine on load.
<select ng-model="fox" ng-options="item for item in fox"></select>
After you make a selection, it splits the selection value into a comma separated list. Try selecting and item, then selecting a different item.
I'm sure it has something to do with the binding, but I can't put my finger on it:
http://jsfiddle.net/LR6DL/1/
It's because you're setting the ng-model of the select to fox. fox is also what your options are set to, so your options array is being over written with the selected value (string) - which then gets split to letters to satisfy the ng-options directive.
Short solution:
Change your ng-model to selection and your input to selection as well.
Demo: http://jsfiddle.net/LR6DL/2/
I am trying to update the selected value in one of the select boxes using knockout. But I am not able to do so. Here is the jsfiddle link - http://jsfiddle.net/5MauG/1/
When I click on the click me span, I expect that the selected value in the select box should change.
You're problem is that trying to set the selected option to a new object won't work. Even with the same values, the new object is not the same as the old object. You can see that in this slightly modified fiddle; it works when actually choosing from the objects in the options array.
With an array of values, like strings or ints, you can select by value. With an array of objects, you need to select with the actual object. This will be easier if your view is using the bindings everywhere, because the bindings will represent the actual objects.