sjg:grid with select with options =,<,> shows undefined - struts2

Have sjg:grid in the jsp. Trying to add a column with a dropdown with options shown as =,<,> . But, in the dropdown it shows as = undefined < undefined undefined etc... .
How to get these option into the grid column dropdown.
I tried the below
<s:url var="searchUrl" action="SearchAction"/>
<s:url var="editSearchUrl" action="editSearchAction"/>
<sjg:grid
id="searchGridId"
formIds="searchFormId"
href="%{searchUrl}"
reloadTopics="reloadSearchGrid"
dataType="json"
pager="true"
gridModel="searchResults"
rowList="10,15,20"
rowNum="15"
rownumbers="true"
viewrecords="true"
autowidth="true"
editurl="%{editSearchUrl}"
editinline="true"
navigator="true"
navigatorAdd="false"
navigatorViewOptions="{height:280, width:500}"
navigatorDelete="false"
navigatorEdit="false"
navigatorRefresh="true"
navigatorSearch="false"
multiselect="false"
onSelectRowTopics="rowselect"
>
<sjg:gridColumn name="orderNumber" index="orderNumber" title="% {getText('label.orderNumber')}" key="true" sortable="true"/>
<sjg:gridColumn name="orderRange" index="orderRange" title="%{getText('label.orderRange)}" sortable="false" editable="true" edittype="select" editoptions="{value:'=:=;<:<;>:>'}"/>
</sjg:grid>

Doing this worked for me as suggested in this post
http://www.trirand.com/blog/?page_id=393/help/problem-using-colon-in-editoptions-as-value
editoptions="{dataUrl:'jsp/test.html'}"
test.html
<select role="select" id="orderRangeId" name="orderRange" size="1" class="editable">
<option role="option" value="=">=</option>
<option role="option" value="<"><</option>
<option role="option" value=">">></option>
</select>

Related

what is f:optionalBlock in jelly

I have seen a jelly file with f:optional block
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form" xmlns:st="jelly:stapler">
<j:choose>
<j:when test="${instance == null}">
<f:entry title="${%File}" field="file">
<input type="file" name="file" size="40" jsonAware="yes"/>
</f:entry>
</j:when>
<j:otherwise>
<f:invisibleEntry>
<f:textbox field="fileName"/>
</f:invisibleEntry>
<f:invisibleEntry>
<f:textbox field="secretBytes"/>
</f:invisibleEntry>
<f:optionalBlock title="${%upload(instance.fileName)}" inline="true">
<f:entry title="${%File}" field="file">
<input type="file" name="file" size="40" jsonAware="yes"/>
</f:entry>
</f:optionalBlock>
</j:otherwise>
</j:choose>
<st:include page="id-and-description" class="${descriptor.clazz}"/>
</j:jelly>
What is f:optional block doing here, i mean whats its significance here ?
Jelly code internally converts to simple HTML and JavaScript code.
<f:optionalBlock> block is used to display a checkbox. When you click on this checkbox, the fields inside the checkbox are displayed on the UI.
In your example, file parameter will be displayed on UI.
We can use inline and checked properties of <f:optional> block

Nesting GSP tags in Grails

This no worky, the onClick handler is removed by Grails when I do a view-source on the HTML output (Grails 1.2.1) What am i missing?
I'm trying to internationalize the confirmation message displayed in the javascript
<g:actionSubmit id="deleteButton" value="Delete" action="deleteActivities" onclick="return confirm(' ${g.message(code="common.confirm.delete", args="['Activity']") } ');"/>
Try to use it as follows:
<g:actionSubmit id="deleteButton" value="Delete" action="deleteActivities" onclick="return confirm(' ${message(code: "common.confirm.delete", args: ['Activity'])} ');"/>

Simple cucumber testing issue

I have a regexp in my cucumber test set up for
Then /I should see "(.*)" before "(.*)"/ do |string1, string2|
and in the following statement I say
page.body.should =~ regexp
where my regexp is
regexp = /#{string1}.*#{string2}/m
This is the scenario
Scenario: sort movies alphabetically
When I follow "Movie Title"
Then I should see "2001: A Space Odyssey" before "Aladdin"
But when I run the test I receive this error
expected: /2001: A Space Odyssey.*Aladdin/m
got: "<!DOCTYPE html>\n<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n<title>Rotten Potatoes!</title>\n<link href=\"/assets/application.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\">\n<script src=\"/assets/application.js\" type=\"text/javascript\"></script>\n</head>\n<body>\n<h1 class=\"title\">Rotten Potatoes!</h1>\n<div id=\"main\">\n<h1>All Movies</h1>\n<form accept-charset=\"UTF-8\" action=\"/movies\" id=\"ratings_form\" method=\"get\">\n<div style=\"margin:0;padding:0;display:inline\"><input name=\"utf8\" type=\"hidden\" value=\"✓\"></div>\n<input id=\"title_sort\" name=\"title_sort\" type=\"hidden\" value=\"true\">\n\nInclude:\nG\n<input id=\"ratings_G\" name=\"ratings[G]\" type=\"checkbox\" value=\"1\">\nPG\n<input id=\"ratings_PG\" name=\"ratings[PG]\" type=\"checkbox\" value=\"1\">\nPG-13\n<input id=\"ratings_PG-13\" name=\"ratings[PG-13]\" type=\"checkbox\" value=\"1\">\nNC-17\n<input id=\"ratings_NC-17\" name=\"ratings[NC-17]\" type=\"checkbox\" value=\"1\">\nR\n<input id=\"ratings_R\" name=\"ratings[R]\" type=\"checkbox\" value=\"1\"><input id=\"ratings_submit\" name=\"commit\" type=\"submit\" value=\"Refresh\">\n</form>\n\n<table id=\"movies\">\n<thead><tr>\n<th class=\"hilite\">Movie Title</th>\n<th>Rating</th>\n<th>Release Date</th>\n<th>More Info</th>\n</tr></thead>\n<tbody id=\"movielist\"></tbody>\n</table>\nAdd new movie\n\n</div>\n</body>\n</html>\n" (using =~)
Diff:
## -1,2 +1,44 ##
-/2001: A Space Odyssey.*Aladdin/m
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Rotten Potatoes!</title>
+<link href="/assets/application.css" media="screen" rel="stylesheet" type="text/css">
+<script src="/assets/application.js" type="text/javascript"></script>
+</head>
+<body>
+<h1 class="title">Rotten Potatoes!</h1>
+<div id="main">
+<h1>All Movies</h1>
+<form accept-charset="UTF-8" action="/movies" id="ratings_form" method="get">
+<div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"></div>
+<input id="title_sort" name="title_sort" type="hidden" value="true">
+
+Include:
+G
+<input id="ratings_G" name="ratings[G]" type="checkbox" value="1">
+PG
+<input id="ratings_PG" name="ratings[PG]" type="checkbox" value="1">
+PG-13
+<input id="ratings_PG-13" name="ratings[PG-13]" type="checkbox" value="1">
+NC-17
+<input id="ratings_NC-17" name="ratings[NC-17]" type="checkbox" value="1">
+R
+<input id="ratings_R" name="ratings[R]" type="checkbox" value="1"><input id="ratings_submit" name="commit" type="submit" value="Refresh">
+</form>
+
+<table id="movies">
+<thead><tr>
+<th class="hilite">Movie Title</th>
+<th>Rating</th>
+<th>Release Date</th>
+<th>More Info</th>
+</tr></thead>
+<tbody id="movielist"></tbody>
+</table>
+Add new movie
+
+</div>
+</body>
+</html>
(RSpec::Expectations::ExpectationNotMetError)
./features/step_definitions/movie_steps.rb:33:in `/I should see "(.*)" before "(.*)"/'
features/sort_movie_list.feature:26:in `Then I should see "2001: A Space Odyssey" before "Aladdin"'
Any suggestions? I'm assuming my error is in my regexp but I cannot find a working solution.
ok, glad to have helped! Answering so I can get the Stack overflow karma... Either your template needs to list the movies or your scenario needs to populate the data you are looking for.

Change the selection state of the litstbox item when a user clicks on a button (ZK 3.6.4)

I'm working in a project with ZK 3.6.4. but I have a problem, I want to change the selection state of the litstbox item when a user clicks on a button inside the same listbox ( same listitem)., because I want to know the selectedItem. I was reading zk documentation and I can do it , but with Zk version 5.0.5+ (nonselectableTags). But I cannot change for this version for project rules. So, there are a way to emulate this behavior with 3.6.4? or what kind of advices can you give me to do this? I really appreciate your help.
Here the code that I have.
<listbox
id="listDocAcads" mold="paging" pageSize="2"
model="#{win$composer.academicCollections}"
selectedItem="#{controller.docEntAcad}" >
<listhead>
<listheader
width="30%" label="Name" />
<listheader
width="15%" label="amount" />
<listheader
width="15%" label=" delivered?" />
<listheader
width="20%" label="Importance" />
<listheader
width="20%" label="Document" />
</listhead>
<listitem
self="#{each='docAcad'}" value="docAcad"
style="border:none;">
<listcell
label="#{docAcad.colleByProcess.oDocument.name}" />
<listcell
label="#{docAcad.colleByProcess.amount}" />
<listcell>
<spinner
width="60%" value="#{docAcad.amount}" />
</listcell>
<listcell
label="#{docAcad.colleByProcess.oImportance.name}" />
<listcell ><button id="btnUploadDocument" label="Upload"/> </listcell>
</listitem>
</listbox>
if you want to ignore button and input's u can do this.
nonselectableTags="button, input".
<listbox nonselectableTags="button, input">
<listitem><listcell><textbox/></listcell></listitem>
<listitem><listcell><button label="button"/></listcell></listitem>
<listitem><listcell><h:input xmlns:h="native"/></listcell></listitem>
<listitem><listcell><datebox/></listcell></listitem>
</listbox>
the values to nonselectableTags should be HTML tags separated by comma.
Hope this helps!

menupopup event listener not get called?

I'm using ice:menuPopup to create menus on tree nodes. In jspx page I've something like this
<ice:tree id="tree" value="#{tree.model}" var="item" imageDir="./xmlhttp/css/xp
/css-images/">
<ice:treeNode>
<f:facet name="icon">
<ice:panelGroup style="display: inline">
<h:graphicImage value="#{item.userObject.icon}"/>
</ice:panelGroup>
</f:facet>
<f:facet name="content">
<ice:panelGroup style="display: inline" menuPopup="menuPopupEffects">
<ice:commandLink actionListener="#{tree.Url}" value="#
{item.userObject.text}"/>
</ice:panelGroup>
</f:facet>
<ice:menuPopup id="menuPopupEffects">
<ice:menuItem value="Open" actionListener="#{tree.NodeValue}">
<f:param name="effectType" value="Open"/>
</ice:menuItem>
<ice:menuItem value="Close">
<f:param name="effectType" value="Close"/>
</ice:menuItem>
<ice:menuItem value="Send">
<f:param name="effectType" value="Send"/>
</ice:menuItem>
</ice:menuPopup>
</ice:treeNode>
The problem is that the actionListener="#{tree.NodeValue}" never gets called. Can any one tell me Where I'm wrong?
Try to move ice:menuPopup..../ice:menuPopup that block up, insert that block into the line just below:
ice:commandLink actionListener="#{tree.Url}" value="#
{item.userObject.text}"
Thus they in the same panelGroup. It works for me this way, but I am still use icefaces 1.8.

Resources