i have a jsp page where i am displaying data in strust2 jquery Grid.
In grid column there is search facility based on the Select type(Drop down select).
<sjg:gridColumn name="subjectId" title="Subject Name" editable="true" align="center" search="true" searchtype="select"
searchoptions="{dataUrl:'%{selecturl}'}" edittype="select" editoptions="{dataUrl:'%{selecturl}'}" />
.My dropdown list is coming fine from my Class as well as it is correctly displaying on its place.
What i want exactly is a header value something like this ( ----select here--) followed by all the values populated from my class.
eg. I know how to do this(below code) in struts2 but i don't know this in struts2 jquery grid column.Now i am only able to display all list without header key & header values.
<s:select label="What's your favor search engine"
headerKey="-1" headerValue="----Select here----"
list="selecturl"
name="name" />
Please help me regarding this issue.
Related
I am working on a customer profile page that has various elements viz. h:selectOneMenu, h:selectOneRadio, h:selectBooleanCheckbox, h:selectManyCheckbox which are populated using master values from the database using List<MasterDTO>. The elements display perfectly when the page is in edit mode. However when the page is changed to view mode, instead of the selected item label being displayed, the selected item value is displayed. E.g. Need to display Single as Marital Status in view mode, instead it displays 001.
Please refer sample code below. I do not want to change the List object to something like a Map<K,V> across all the code. I am using JSF 2.0 and Primefaces 3.4.2. Is there a solution for this?
Select One Menu
<h:selectOneMenu id="marital_status" style="width:178px;"
rendered="#{customerProfileBean.editMode}"
value="#{customerProfileBean.marital_status}">
<f:selectItem itemValue="-1" itemLabel="--- Select ---" />
<f:selectItems value="#{customerProfileBean.maritalStatusList}"
var="mst" itemLabel="#{mst.valueName}" itemValue="#{mst.valueCode}" />
</h:selectOneMenu>
<h:outputText rendered="#{not customerProfileBean.editMode}"
value="#{customerProfileBean.marital_status}" />
Select Many Check Box
<h:selectManyCheckbox id="loanTypes" styleClass="selectOptionSpace"
rendered="#{customerProfileBean.editMode}"
value="#{customerProfileBean.loanTypes}">
<f:selectItems value="#{customerProfileBean.creditFacList}"
var="mst" itemLabel="#{mst.valueName}" itemValue="#{mst.valueCode}" />
</h:selectManyCheckbox>
<h:outputText rendered="#{not customerProfileBean.editMode}"
value="#{customerProfileBean.custLoanType}" />
Replaced the jsf controls with the primefaces controls viz. p:selectOneMenu and p:selectManyCheckbox which fixed the problem of displaying value instead of code.
I have a dropdown and checkbox in my page and if we select a dropdown then the checkbox has to be disabled. We should not use JavaScript for this. I am new to JSF. Is there a way by using JSF. Any ideas.
Just add a <f:ajax> which executes on change of the dropdown and updates the checkbox whereby its disabled attribute checks if the dropdown's value is not empty.
E.g.:
<h:selectOneMenu value="#{bean.selectedItem}">
<f:selectItems value="#{bean.availableItems}" />
<f:ajax render="checkbox" />
</h:selectOneMenu>
<h:selectBooleanCheckbox id="checkbox" disabled="#{not empty bean.selectedItem}" />
That's basically all.
Please note that this uses under the covers still JavaScript for the job! The only difference is that you don't need to manually write any line of JavaScript code, instead JSF autogenerates the necessary JS code for you.
I have Three checkbox
<g:checkBox name="startAccountingStatus" value="Yes" />
<g:checkBox name="startAccountingStatus" value="No" />
<g:checkBox name="startAccountingStatus" value="NA" />
i want something like RadioGroup. Here now i can select all the checkBoxes. i dont want that..
I can check only one checkBox.
I can do it in jQuery which i dont want to ..
Is there any way of achieving it in Grails Gsp.
Why don't you go with HTML radio group, also present in Grails?
You can make radio items look like checkbxes.
If you want the check be made on the client browser and not checked at server side after submission the only way is via javascript (jquery, prototype or simple javascript it's little important)
I want to create a form that contains text boxes as follow. I am using Struts2.
User Name
|Text Box for user name|
mail id
|Text box for mail id|
<s:textarea name="username" id="username" label="User Name"/>
This is showing:
User name |Text Box for user name|
But I want the above format. When I am using validation framework label is shown in italic, I want normal text.
That is because of default struts2 theme factor xhtml which is showing the output html in table structure
Change the theme to simple ans use your own css/HTML way to customize the output
crate a struts.properties file and add the following entry
struts.ui.theme=simple
this will change the theme for whole application as struts2 tags will no longer generates HTML/table code for you
else u can override the theme per page basis
like
<s:set name="theme" value="'simple'" scope="page" />
alternate way can be what "Steven" suggested
You're in luck. Just add the labelposition="top" attribute to your Struts2 input tags. e.g.,
<s:textfield name="subject"
label="Subject"
size="30"
maxlength="50"
labelposition="top"
required="true"/>
As for the italic label, that should be controlled by CSS.
Why is it that when I insert an element in between the s:textfield it gets placed on top?
Is there a way to fix that?
Thanks for helping on this.
<s:textfield label="First Name" required="true"/>
<s:textfield label="Last Name" required="true"/>
<s:text name="testing1">test1</s:text>
<s:textfield label="Address" required="false"/>
<s:textfield label="Email" required="true"/>
<s:text name="testing2">test2</s:text>
Order being displayed on browser:
test1
test2
First Name
Last Name
Address
Email
I guess my answer to this question comes too late, but I respond to this just for the record.
The reason why the text elements don't appear in between is because struts renders a table to display your input fields (and their labels). If you look at the HTML rendered by struts you will see one tag for each textfield. If you insert any other component between these, struts will not know how to format these into the table of the form, resulting in the items being displayed before the start of the table.
To avoid this behavior you can set the "theme" attribute of the form to "simple". This will result in the fact that you will need to do all formatting by yourself.
Hope this helps.