bootsfaces selectMultiMenu don't show selected values - multi-select

I want to pre-charge a selectMultiMenu with values I already have in the application.
For example:
<b:panelGrid colSpans="2,2,8">
<h:outputLabel value="Traffic light color" />
<b:selectMultiMenu value="#{semaphoreBean.color}" >
<f:selectItems value="#{semaphoreBean.colors}" var="c" itemValue="#{c}" itemLabel="#{c}"/>
</b:selectMultiMenu>
</b:panelGrid>
if var color = "green, red" before than I load the page, I don't see in my selectMultiMenu 2 items selected.
¿What do I have to do to pre-load that field with those values?

Maybe that's because of the space between the entries. I take it you've take the example from our showcase. So I've added this line to our showcase, and it works like charm:
private String color = "green,red";

Finally I found out data format was wrong so I fix it and works.
Thank you for helping.

Related

sendKeys with p:calendar does not yield reliable results from one run to another

I am using selenium to fill a p:calendar field. Instead of using the date picker, I send the keys to the field directly.
webDriver.findElement(By.id("theId").sendKeys("06031984");
Before and after this, I am interacting with various other elements on the page. With each run, I am getting different values appearing in my date input field - and rarely are these the correct ones:
40.60.3198
98.40.6031
06.03.1984 <- Correct
The order of the keys seems to be shifted, probably by the ajax calls in the p:calendar:
<p:calendar id="theId" styleClass="date-input"
binding="#{date}" navigator="true"
value="#{aView.date}"
validator="dateValidator"
yearRange="#{validatorService.dateRange}"
pattern="dd.MM.yyyy" mask="99.99.9999" readonlyInput="false"
readonly="false" required="true" showOn="button"
requiredMessage="#{i18n['aMsg']}"
locale="de">
<p:ajax event="dateSelect"
update="many elements"
oncomplete="updateTabbing();" />
<p:ajax event="change"
update="many elements"
oncomplete="updateTabbing();" />
</p:calendar>
Is there a way to ensure the correct value ends up in the field ?
So far I find working with Selenium (and a JSF page) to be a bit of a hassle.
We can try adding some wait and send tab key
or injecting java script for the value would Solve this problem
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("document.getElementsByid('theId').value = '06.03.1984';");
Please let me know if its solving the problem.

jqGrid - sorting won't work when datatype:local (jsFiddle included)

I couldn't find any solution.
I want to load my data from a local array. When I use the same settings in a different grid with datatype:json, from server, everything works fine.
But here I need a local array, I use data option. array is in format:
[[x,y,z], ...]
JSFIDDLE:
http://jsfiddle.net/7osga648/
CODE:
$("#datagrid1").jqGrid({
datatype:'local',height:350,width:400,gridview:true,rownumbers:true,rowNum:1000,viewrecords:true,
colNames:["time","col1","col2"],
colModel:[
{name:'time',width:150,resizable:false,sorttype:'date',datefmt:"d/m/Y H:i:s"},
{name:'f1',width:100,resizable:false,sorttype:'number'},
{name:'f2',width:100,resizable:false,sorttype:'number'}],
data:[["03/10/2014 20:46:27","60.8","2.5"],["03/10/2014 21:01:39","58.3","0.1"],["03/10/2014 21:16:51","61.3","3.4"],["03/10/2014 21:32:05","58.9","0.6"],["03/10/2014 21:47:18","58.7","0.8"],["03/10/2014 22:02:32","58.2","0.0"],["03/10/2014 22:17:45","61.9","3.8"],["03/10/2014 22:32:58","58.4","0.1"],["03/10/2014 22:48:11","60.0","2.1"],["03/10/2014 23:03:22","61.2","3.4"],["03/10/2014 23:18:34","62.0","3.8"],["03/10/2014 23:33:47","58.6","0.2"],["03/10/2014 23:49:00","58.4","0.2"],["04/10/2014 00:04:14","58.1","0.2"],["04/10/2014 00:19:28","58.1","0.2"],["04/10/2014 00:34:40","61.8","3.9"],["04/10/2014 00:49:51","58.9","0.6"],["04/10/2014 01:05:03","58.2","0.1"],["04/10/2014 01:20:16","61.2","3.4"],["04/10/2014 01:35:28","59.2","0.9"],["04/10/2014 01:50:40","58.4","0.1"],["04/10/2014 02:00:04","0","0"],["04/10/2014 02:05:52","61.8","3.7"],["04/10/2014 02:21:04","62.9","3.7"],["04/10/2014 02:36:15","63.1","3.5"],["04/10/2014 02:51:27","63.7","3.5"],["04/10/2014 03:06:40","60.1","0.0"],["04/10/2014 03:21:53","63.1","3.1"]],
localReader:{repeatitems:true,cell:""},
caption:"sorting not working. click on col header"
});
Try to click on column header, and see that nothing is happening.
Any idea?
I posted already the bug fix here. The modified demo "jsfiddle.net/7osga648/4/" uses directly the new features. See the answer for additional information.

Do anyone has the source caman js example on site?

I am trying to create the functionality like this page url : http://camanjs.com/examples/ for image filters.
I have tried with this code.
var img_map = Caman("#test-canvas", "../images/test1_640.jpg");
//update brightness
function update_brightness(value){
//img_map.revert();
img_map.brightness(value).render();
}
//update contrast
function update_contrast(value){
//img_map.revert();
img_map.contrast(value).render();
}
The changes on image are not like the site i am refering.
The main issue is when i increase any control then it works fine. But when I try to decrease the control value then it does not work.
To control the value for brightness or contrast i have used "range" input.
<img id="test-image" src="../images/test1_640.jpg" />
<canvas id="test-canvas"></canvas>
brightness
<input onchange="update_brightness(this.value);" type ="range" min ="-100" max="100" step ="10" value ="0"/>
contrast
<input onchange="update_contrast(this.value);" type="range" min="-100" max="100" step="" value="0">
EDIT: I just compiled the coffeescript out to JavaScript and put it in a repo of my own for (hopefully) easier use:
https://github.com/nbieber/CamanJS-example
You can find the original source here: https://github.com/meltingice/CamanJS-Site/blob/master/_assets/javascripts/examples.js.coffee
It's in coffeescript, though.
You can add
this.revert(true);
in your update_brightness and update_contrast functions.
function update_brightness(value){
//img_map.revert();
this.revert(true);
img_map.brightness(value).render();
}

How to flex TextField in qooxdoo mobile

I'm trying to add a row on a qx.ui.mobile.page.NavigationPage consisting of a label, a text field, and a button. I want the text field to take up any extra horizontal space (the row should span the screen horizontally). I thought this would work:
var comp = new qx.ui.mobile.container.Composite();
comp.setLayout(new qx.ui.mobile.layout.HBox(null, 'middle'));
comp.add(new qx.ui.mobile.basic.Label("Filtering:"));
var f = new qx.ui.mobile.form.TextField();
comp.add(f, {flex:1});
var b = new qx.ui.mobile.form.Button("Update");
comp.add(b);
this.getContent().add(comp);
but it doesn't (see http://tinyurl.com/nwlhtwq for a playground example).
What am doing wrong? Thanks!
Have a look at this example:
http://tinyurl.com/nmw6lgs
It is because the textfield has a "display:inline-block" by default, and width of 100%.
Please set these properties:
qx.bom.element.Style.set(textField.getContentElement(),"display","block");
qx.bom.element.Style.set(textField.getContentElement(),"width","auto");
We will fix that in framework, too.

Ampersand in XAML

When I set the Text property of RolesTextName from codebehind in a Silverlight5 app by doing:
RolesTextName.Text = "David & Goliath";
<TextBlock TextWrapping="Wrap">
<Span FontWeight="Bold">Roles:</Span>
<Span><Run x:Name="RolesTextName" /></Span>
</TextBlock>
Problem: I don't get the & symbol, just the actual text.
XAML is used to create an object graph that represents your user interface. When you modify the user interface by setting property values in code the XAML has already been processed and is no longer used. You should not do any XAML specific encoding when modifying the object graph from code. Encoding is only required in XAML because it is based on XML and you need a way to represents characters like &, < and > unambgiously.
So executing
RolesTextName.Text = "David & Goliath";
will set the text of the run to
David & Goliath
To achieve what you want simply execute this code insted:
RolesTextName.Text = "David & Goliath";
Hi im also quite new to XML, but I've had a similar problem in the past
This link gave me some insight, hope it can help you.
`<![CDATA[Wake & Bake]]>
http://www.w3schools.com/xmL/xml_cdata.asp

Resources