Ext JS--How to make itemSelector values unselectable? - extjs

Inside my itemSelector's value config, I have set the values like so:
value:["A","B","C"]
A,B, and C are mandatory and thus cannot be deselected. How do I stop these values from being deselected?
Thanks

You can capture the beforedeselect event and return false for these items. It would help people answer question more appropriately if you post your code here.

Related

Coldfusion array from form checkbox

I am trying to figure out the best way to handle this. I have a series of form fields with checkboxes for people to select options. When that gets submitted it turns form.optiongroups into an array. I then check to see if the id of the optiongroup is in the array and set the checked value to true in case there were form errors I want them to retain their checked value. This all works fine.
If I only select one option though it doesn't come through as an array, but just a regular form field. Is there a way I can handle this to make sure it is always an array?
Actually, checkboxes get submitted as a list. You must have something else going on that creates the array.
However, to answer your question as asked, you can use ListToArray(). It would be something like this:
if (structkeyexists(form, 'optiongroups') { // if no boxes are checked the variable will be undefined.
if (isArray(form.optiongroups) == false )
form.optiongroups = ListToArray(form.optiongroups)
} else {
code for no boxes checked
}
It could also be done via...
param form.optiongroups = "";
form.optiongroups = ListToArray(form.optiongroups);

How to check duplicate values in more then one rows in Angular ui-grid.

I am beginner in of AngularJS therefore I have a simple question.
Is there any method provided or sample code in ui-grid to check the duplicate values in more then one rows in ui-grid.?
i want to color the cell where duplicate value exist.
There is no TRUE built-in way, however using $watch is one solution. If values in your ui-grid are bound to a variable called myGridVals, you would do something like this:
$scope.$watch('myGridVals',function(newval,oldval) {
// loop through myGridVals and see if newval matches anything
});
Note that if your array holds objects you'll want to do a DEEP watch which means adding a third param to $watch(..,..,true);
You can also

Xpages Combobox -setting the default value

I have a combobox with values being populated from a managed bean like so:
keywordlist.setConnDB("jdbc:sqlserver://xx.xx.x.xx:1433;DatabaseName=xxx");
keywordlist.setConnUserName("xxx");
keywordlist.setConnPassword("xxx");
keywordlist.setSQLQuery("SELECT DisplayText as Keyword From Glossary WHERE SUBSTRING(DisplayText, 1, 2)= 'RV'");
keywordlist.keywords;
I'd like to be able to set the default to '--- Select ---', but no matter what I do the keyword list always picks the first of the returned keywords as the default.
Any assistance would be much appreciated.
Thanks,
Dan
Add another value pair (on first position), type "formula item" with the following SSJS return value:
"-- Select --|"
Notice the pipe!
That should display this at first position and should also be defaulted as "empty" is the default value. If not, set the "alias" (the value after the pipe) to something that you can define as default value porperty for the combo item.
It might be because you're binding to the bean directly. You might have to add that value to your keyword list itself. I think I have an example of this in a NotesIn9 show: http://notesin9.com/index.php/2014/03/13/notesin9-138-xpages-combobox-improvements/
I'm not sure. If I don't have a default in the java code you can probably see how it might be done.
Try that. If that doesn't work at all then maybe you don't bind the combo box to the bean directly. Maybe bind it to a viewScope var... since that can be anything it'll take a blank... then you just need to move the viewScope var value back up to your bean in the onChange event or something.
Just a quick thought...
Basically, the following pattern could be a start point for such a combobox:
<xp:comboBox
id="comboBox1"
defaultValue=""
value="#{document1.someField}">
<xp:selectItem
itemLabel="--- Select ---"
itemValue=""></xp:selectItem>
<xp:selectItems>
<xp:this.value><![CDATA[#{javascript:
// Your SSJS code...
// Should return some kind of list...
return items;
}]]></xp:this.value>
</xp:selectItems>
</xp:comboBox>
Alternatively, you can grab the keyword values from a Java bean:
<xp:selectItems value=#{yourBean.yourValue}></xp:selectItems>
Still, it's important to return a list value. It might also have "label|value" format.

ComboBox in X++

In my ComboBox there are items like A B C D and bydefault the value is A where i want to make it as C something like comboBox.comboType(2) in the init form, but this doesnt seems to work.
May be ComboBox.selection(2) helps, m not sure, Kindly help.
You can use this code in the form's init method after super():
ComboBoxName.selection(ComboBoxName::DefaultValue);
If this is a table field I'd suggest overriding the initValue method in the table:
this.ComboBoxName = ComboBoxName::DefaultValue;
Override initValue in the form's datasource only if it should be a specific behaviour in this form only.
All I did is overrided the initValue method of the form n wrote the code as tableName.ComboBoxName = ComboBoxName::DefaultValue;
And its working fine. Correct me if I am wrong :)

Dojo: checking values in a dijit.form.ComboBox

Hey guys! I have a dijit.form.ComboBox that needs have value checking applied against it.
Specifically the box is below...
<input dojoType="dijit.form.ComboBox"
store="xvarStore"
value="[% xv %]"
searchAttr="name"
name="xvar_names_[% section_count %]_arg_[% loop.count %]"
id="xvar_names_[% section_count %]_arg_[% loop.count %]"
/>
the [% ..... %] stuff are values from Template Toolkit.
Anywho, the point of a ComboBox of course is that you can select a value or put your own in and that functionality I am not looking to change. What I do need to do is pop up or somehow nag someone if they put a value in that not in the list.
Anyone have a clue how I might do this. I thought about an onBlur event but I'm still a little mystified.
Any pointers in the right direction would be appreciated.
Janie
If you want to require that the user enter a value that is in the list, then you probably want FilteringSelect, not ComboBox. FilteringSelect does exactly this.
http://dojotoolkit.org/reference-guide/dijit/form/FilteringSelect.html
I've contrasted these two widgets in a blog post:
http://kennethfranqueiro.com/2010/06/combobox-vs-filteringselect/
The documentation for dijit.form.ComboBox is probably the best place to start, but you have the right idea. The onChange or onBlur events seem the most appropriate, but you could also write a custom validate function that would nag the user if values weren't in the list.

Resources