Visualforce Toolbar Rerender Firefox bug - apex-code

I have a Visualforce toolbar and when I rerender the pageblock only in Firefox the whole bar gets extended vertically to a large toolbar block.
See code below
<apex:toolbar id="theToolbar" style="background-color:#8d8d8d;background-image:none">
<apex:toolbarGroup itemSeparator="line" location="left" id="toobarGroupForm">
<apex:outputText style="color:#f8f8ff;font-weight:bold" value="Amount of Records"/>
<apex:selectList label="Record Amount" value="{!ShowAmountOfRecords}" size="1" required="false" >
<apex:actionSupport event="onchange" action="{!AmountOfRecordsAction}" reRender="innerblock" status="recordamountchange" />
<apex:outputPanel style="color:#f8f8ff;font-weight:bold">
<apex:actionStatus id="recordamountchange" startText="Showing more records..." stopText=""/>
</apex:outputPanel>
<apex:selectOptions value="{!AmountOfRecordsList}"/>
</apex:selectList>
<apex:outputText style="color:#f8f8ff;font-weight:bold" value="Filter By Document Type"/>
<apex:selectList label="Filter by Record Type" value="{!FilterByRecordType}" size="1" required="false" >
<apex:actionSupport event="onchange" action="{!FilterByRecordTypeAction}" reRender="innerblock" status="filterByRecordType" />
<apex:outputPanel style="color:#f8f8ff;font-weight:bold">
<apex:actionStatus id="filterByRecordType" startText="Filtering your records..." stopText=""/>
</apex:outputPanel>
<apex:selectOptions value="{!FilterByRecordTypeList}"/>
</apex:selectList>
</apex:toolbarGroup>
</apex:toolbar>
Is this a know bug in Firefox?

The problem was that I had two picklist part of the same Toolbar Group. Make sure to add your components to different toolbar groups.
<apex:toolbar id="theToolbar" style="background-color:#8d8d8d;background-image:none" rendered="true">
<apex:outputText style="color:#f8f8ff;font-weight:bold" value="Amount of Records"/>
<apex:toolbarGroup itemSeparator="line" location="left" id="toobarGroupForm" rendered="true">
<apex:selectList label="Record Amount" value="{!ShowAmountOfRecords}" size="1" required="false" >
<apex:actionSupport event="onchange" action="{!AmountOfRecordsAction}" status="recordamountchange" reRender="innerblock" />
<apex:outputPanel style="color:#f8f8ff;font-weight:bold">
<apex:actionStatus id="recordamountchange" startText="Showing more records..." stopText=""/>
</apex:outputPanel>
<apex:selectOptions value="{!AmountOfRecordsList}"/>
</apex:selectList>
</apex:toolbarGroup>
<apex:outputText style="color:#f8f8ff;font-weight:bold" value="Filter By Document Type"/>
<apex:toolbarGroup itemSeparator="line" location="left" id="toobarGroupForm2" rendered="true">
<apex:selectList label="Filter by Record Type" value="{!FilterByRecordType}" size="1" required="false" >
<apex:actionSupport event="onchange" action="{!FilterByRecordTypeAction}" status="filterByRecordType" reRender="innerblock"/>
<apex:outputPanel style="color:#f8f8ff;font-weight:bold">
<apex:actionStatus id="filterByRecordType" startText="Filtering your records..." stopText=""/>
</apex:outputPanel>
<apex:selectOptions value="{!FilterByRecordTypeList}"/>
</apex:selectList>
</apex:toolbarGroup>
</apex:toolbar>

Related

CommandItemSetting section in RadGrid is not displayed when Grid has less than 10 records

I'm using CommandItemSettings in MasterTablreView to show Export to Excel button.
The CommandItemSettings section of the grid is displayed when Grid has at least 10 records or when I select less than 10 records using a Pager.
However, with less than 10 records after I click the Search button, the CommandItemSettings section is not there and I cannot export the data into an Excel.
Here is the aspx file:
MOSS2 Merchants Report:
<telerik:RadAjaxManager ID="RadAjaxManager" runat="server" EnableAJAX="true">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="btnSearch">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="grdMoss2Merchants" LoadingPanelID="RadAjaxLoadingPanel2"></telerik:AjaxUpdatedControl>
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
<table class="moss2Search" width="100%">
<tr>
<td colspan="4">
<asp:CustomValidator ID="checkForTwoDates" ClientValidationFunction="AtLeastOneDate_ClientValidate"
EnableClientScript="True" ErrorMessage="At least one date should be selected" runat="server"></asp:CustomValidator> <br />
<asp:CompareValidator ID="CompareValidator2" ControlToCompare="RadDatePicker1" ControlToValidate="RadDatePicker2" Operator="GreaterThanEqual"
ErrorMessage="Date range is not valid" runat="server"></asp:CompareValidator>
</td>
</tr>
<tr>
<td>
<div runat="server">
<asp:Label runat="server" CssClass="dateLabels">Boarding Start Date</asp:Label>
<telerik:RadDatePicker RenderMode="Lightweight" ID="RadDatePicker1" runat="server" onkeydown="keyPress(this, event)">
<Calendar runat="server">
<FastNavigationSettings EnableTodayButtonSelection="true"></FastNavigationSettings>
</Calendar>
</telerik:RadDatePicker>
</div>
</td>
<td>
<div runat="server">
<asp:Label runat="server" CssClass="dateLabels">Boarding End Date</asp:Label>
<telerik:RadDatePicker RenderMode="Lightweight" ID="RadDatePicker2" runat="server" onkeydown="keyPress(this, event)">
<Calendar runat="server">
<FastNavigationSettings EnableTodayButtonSelection="true"></FastNavigationSettings>
</Calendar>
</telerik:RadDatePicker>
</div>
</td>
<td>
<div>
<asp:CheckBox ID="chkMerActive" runat="server" Checked="true" TextAlign="Left"/>Active
</div>
</td>
<td>
<telerik:RadButton RenderMode="Lightweight" runat="server" Text="Search" ID="btnSearch" OnClick="btnSearch_Click"/>
</td>
</tr>
</table>
<asp:Label ID="lblMsg" ForeColor="red" runat="server"></asp:Label>
<br />
</telerik:RadAjaxPanel>
<%----%>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server" Skin="Default">
</telerik:RadAjaxLoadingPanel>
<telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server" LoadingPanelID="RadAjaxLoadingPanel2">
<telerik:RadGrid
RenderMode="Lightweight"
runat="server"
ID="grdMoss2Merchants"
AllowPaging="True"
AllowSorting="true"
PagerStyle-AlwaysVisible="true"
OnNeedDataSource="BindToDatasource"
OnSortCommand="grdMoss2Merchants_SortCommand"
ViewStateMode="Enabled"
AutoGenerateColumns="false"
OnPageIndexChanged="grdMoss2Merchants_ChangePage"
ClientSettings-Scrolling-ScrollHeight="360px">
<GroupingSettings CaseSensitive="false"/>
<ExportSettings HideStructureColumns="true" ExportOnlyData="true" OpenInNewWindow="true" Excel-Format="Xlsx" IgnorePaging="true" FileName="Moss2Merchants">
<Excel WorksheetName="Moss2Merchants" Format="Xlsx" AutoFitColumnWidth="AutoFitAll" />
</ExportSettings>
<ClientSettings EnableRowHoverStyle="true">
<Scrolling AllowScroll="true" UseStaticHeaders="True"/>
</ClientSettings>
<SortingSettings EnableSkinSortStyles="false" />
<HeaderStyle Width="160px" CssClass="grdHeader" ForeColor="#2E6E9E" />
<MasterTableView AllowNaturalSort="false" CommandItemDisplay="Bottom">
<CommandItemSettings ShowExportToExcelButton="true" ShowAddNewRecordButton="false" ShowRefreshButton="false" />
<CommandItemStyle HorizontalAlign="Right" />
<PagerStyle AlwaysVisible="true" Mode="NextPrevAndNumeric" PageSizes="5,10,25,50,100" />
<Columns>
<telerik:GridBoundColumn DataField="Moss2 MID" HeaderText="MOSS2 MID" AllowSorting="false" DataFormatString="{0:#}"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DBA" HeaderText="DBA" HeaderStyle-Width="250px">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Original MID" HeaderText="ORIGINAL MID" AllowSorting="false" DataFormatString="{0:#}"></telerik:GridBoundColumn>
<telerik:GridBoundColumn
DataField="BoardingDate"
DataType="System.DateTime"
HtmlEncode="false"
DataFormatString="{0:MM/dd/yyyy}"
SortExpression="BoardingDate"
UniqueName="BoardingDate"
HeaderText="BOARDING DATE"
HeaderStyle-Width="170px"
ShowFilterIcon="false"
/>
<telerik:GridBoundColumn DataField="Status" HeaderText="STATUS" AllowSorting="false"></telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
</telerik:RadAjaxPanel>
The Export To Excel button is showing with Grid having

Merging rows in dynamically binded apex:pageblockTable in visualforce page

I am new to Salesforce VF pages. I have a dynamically binded pageBlockTable in my Visualforce page. I wanted to merge certain dynamic rows based on a condition. Could someone please suggest, if there is any possible way to merge rows(or subrows) in apex:pageblocktable based on some conditions?
I have tried googling this, but could find no clues.
Any help is really appreciated.
Visualforce page code:
<apex:pageblock id="listBlock">
<apex:pageblockTable value="{!lstcomp}" var="oComp" styleclass="table table-striped table-hover" id="sysTable" rowClasses="even,odd">
<apex:column headerClass="TableTitle" style="width: 20%;height:4%" ><apex:facet name="header"><font class="headerfontstyle" >Name</font></apex:facet>
<font class="rowdatastyle"> {!oComp.Name} </font>
</apex:column>
<apex:column headerClass="TableTitle" style="width: 10%;height:4%" ><apex:facet name="header"><font class="headerfontstyle" >Mfg</font></apex:facet>
<font class="rowdatastyle" > {!oComp.Manufacturer}</font>
</apex:column>
<apex:column headerClass="TableTitle" style="width: 6%;height:4%"><apex:facet name="header"><font class="headerfontstyle" >Type</font></apex:facet>
<font class="rowdatastyle" > {!oComp.ComponentType} </font>
</apex:column>
<apex:column headerClass="TableTitle" style="width: 12%;height:4%"><apex:facet name="header"><font class="headerfontstyle" >Allocated</font></apex:facet>
<font class="rowdatastyle"> {!oComp.Allocated} </font>
</apex:column>
<apex:column headerClass="TableTitle" style="width: 10%;height:4%"><apex:facet name="header"><font class="headerfontstyle" >Used</font></apex:facet>
<font class="rowdatastyle"> {!oComp.Used} </font>
</apex:column>
<apex:column headerClass="TableTitle" style="width: 30%;height:4%"><apex:facet name="header"><font class="headerfontstyle" >Version</font></apex:facet>
<font class="rowdatastyle">{!oComp.OS} </font>
</apex:column>
</apex:pageblockTable>
You could group your records base on certain conditions and show the rest of fields as from child records.
<apex:pageblockTable>
<apex:column value="{!acc.name}">
<apex:column>
<apex:facet name="header"> Team Members </apex:facet>
<apex:pageblocktable value="{!acc.AccountTeamMembers}" var="tm">
<apex:column headerValue="Team Member">
<apex:outputfield value="{!tm.User.Name}"/>
</apex:column>
<apex:column headerValue="Role">
<apex:outputfield value="{!tm.TeamMemberRole}"/>
</apex:column>
</apex:pageblocktable>
</apex:column>
</apex:pageblockTable>

how to load data in jqgrid column in jsp from database?

It is my mini project..
Here is my jsp code:
<body>
<s:form id="up_bank_form" name="up_bank_form" theme="simple" action="up_bank_deposit">
<s:url id="remoteurl" action="up_bank_grid_act"/>
<s:url id="editid" action="gridcrudurl"/>
<s:url id="bnkbranch_url" action="bnknamecmbAct1"/>
<sjg:grid
id="gridtable"
caption="ACCOUNT DEPOSIT DETAILS"
dataType="json"
loadonce="true"
href="%{remoteurl}"
editurl="%{editid}"
gridModel="faph_gridModel"
cssStyle="font-size:10px"
pager="true"
rowList="25,50,75"
rowNum="0"
rownumbers="true"
viewrecords="true"
width="790"
height="250"
onCompleteTopics="cal_tot"
footerrow="true"
userDataOnFooter="true"
reloadTopics="reloadSearchedClaims"
navigatorSearch="false"
navigatorRefresh="false"
navigatorView="false"
navigator="true"
navigatorAdd="false"
navigatorDelete="false"
navigatorEdit="true"
editinline="true"
onEditInlineAfterSaveTopics="editline"
onEditInlineErrorTopics="editline_error"
>
<sjg:gridColumn name="refid" index="refid" title="ref_id" width="20" key="true" hidden="true"/>
<sjg:gridColumn name="bankname" index="bankname" title="bankname" width="20" key="true" hidden="false"/>
<sjg:gridColumn name="branchname" index="branchname" title="Branch Name" width="90"/>
<sjg:gridColumn name="accountno" index="accountno" title="Account No" width="90" edittype="select" editable="true" editoptions= "{dataUrl : '%{bnkbranch_url}'}" surl="%{bnkbranch_url}" />
<sjg:gridColumn name="date" index="date" title="Record Date" width="50" formatter="date" align="center" formatoptions= "{srcformat:'y-m-d', newformat: 'd-M-Y' }"/>
<sjg:gridColumn name="depdate" index="depdate" title="Date" width="50" formatter="date" align="center" formatoptions= "{srcformat:'y-m-d', newformat: 'd-M-Y' }"/>
<sjg:gridColumn name="amount" index="amount" title="Amount" width="70" formatter="currency" align="right" sortable="true" editable="true" edittype="text" />
<sjg:gridColumn name="status" index="status" width="20" title="Status" />
</sjg:grid>
</s:form>
</body>
when i edit a row i want to get data from database and load into accountno column. How to do it?
refer above code and answer me if you have some idea!! Thanks!!

Bean value not updated with Ajax

I have a PopupPanel with a form inside. The form has been previously rendered by ajax, so by some issue / bug with richfaces, I am forced to put the a4j:commandButton outside the form, with an execute attribute.
When I hit the button, it calls the server but the bean value is not updated.
Any suggestion?
Simplied code of my form:
<rich:popupPanel id="workOrderPopup" modal="true" resizeable="true"
onmaskclick="#{rich:component('workOrderPopup')}.hide()" width="750" height="420">
<h:form id="editWorkOrderForm" onkeypress="if (event.keyCode == 13) { document.getElementById('workOrderEdition:saveWO').click(); return false; }">
[[[FORM FIELDS]]]
</h:form>
<a4j:commandButton id="createWO" value="Guardar" action="#{ticketCont.saveWorkOrder()}"
render="workOrders,footer" execute="editWorkOrderForm" oncomplete="#{rich:component('workOrderPopup')}.hide()"/>
</rich:popupPanel>
Complete code of my form:
<rich:popupPanel id="workOrderPopup" modal="true" resizeable="true"
onmaskclick="#{rich:component('workOrderPopup')}.hide()" width="750" height="420">
<h:form id="editWorkOrderForm" onkeypress="if (event.keyCode == 13) { document.getElementById('workOrderEdition:saveWO').click(); return false; }">
<table width="100%" id="editWorkOrderTable">
<tr>
<td>
<h:outputText value="ID" for="editedWOId"/><br/>
<h:inputText value="#{ticketCont.workOrder.id}" id="editedWOId" readonly="true" size="7"/>
</td>
<td>
<h:outputText value="DescripciĆ³n" for="editedWODescription"/><br/>
<h:inputText value="#{ticketCont.workOrder.description}" id="editedWODescription"/>
</td>
<td>
<h:outputText value="Estado" for="editedWOState"/><br/>
<h:selectOneListbox value="#{ticketCont.workOrder.status}">
<f:selectItem itemLabel="Abierto" itemValue="0"/>
<f:selectItem itemLabel="Cerrado" itemValue="1"/>
</h:selectOneListbox>
</td>
<td>
<h:outputText value="Tiempo (en horas)" for="editedWOTime"/><br/>
<rich:inputNumberSpinner value="#{ticketCont.workOrder.workHours}" inputSize="4"/>
</td>
</tr>
<tr>
<td colspan="4">
<div align="center">
<h:outputText value="Recursos" for="editedWOResources"/><br/>
<rich:pickList value="#{ticketCont.workOrder.resources}" var="_resource" listHeight="200px" id="editedWOResources">
<f:selectItems value="#{ticketCont.activeResources}"/>
<f:converter converterId="es.caib.gesma.gesman.data.converter.ResourceConverter" />
<rich:column>
#{_resource.name}
</rich:column>
</rich:pickList>
</div>
</td>
</tr>
</table>
</h:form>
<a4j:commandButton id="createWO" value="Guardar" action="#{ticketCont.saveWorkOrder()}"
render="workOrders,footer" execute="editWorkOrderForm" oncomplete="#{rich:component('workOrderPopup')}.hide()"/>
</rich:popupPanel>
I am using JBoss 6.1, Mojarra 2.1.9 and Richfaces 4.
i think problem is not in this code but problem from other click your editWorkOrderForm is render for that your from is not working...
for that you can do like that..
<rich:popupPanel id="workOrderPopup" modal="true" resizeable="true"
onmaskclick="#{rich:component('workOrderPopup')}.hide()" width="750" height="420">
<h:form id="editWorkOrderForm" onkeypress="if (event.keyCode == 13) { document.getElementById('workOrderEdition:saveWO').click(); return false; }">
<a4j:outputpanal id="editWorkOrderPanal">
<table width="100%" id="editWorkOrderTable">
<tr>
<td>
<h:outputText value="ID" for="editedWOId"/><br/>
<h:inputText value="#{ticketCont.workOrder.id}" id="editedWOId" readonly="true" size="7"/>
</td>
<td>
<h:outputText value="DescripciĆ³n" for="editedWODescription"/><br/>
<h:inputText value="#{ticketCont.workOrder.description}" id="editedWODescription"/>
</td>
<td>
<h:outputText value="Estado" for="editedWOState"/><br/>
<h:selectOneListbox value="#{ticketCont.workOrder.status}">
<f:selectItem itemLabel="Abierto" itemValue="0"/>
<f:selectItem itemLabel="Cerrado" itemValue="1"/>
</h:selectOneListbox>
</td>
<td>
<h:outputText value="Tiempo (en horas)" for="editedWOTime"/><br/>
<rich:inputNumberSpinner value="#{ticketCont.workOrder.workHours}" inputSize="4"/>
</td>
</tr>
<tr>
<td colspan="4">
<div align="center">
<h:outputText value="Recursos" for="editedWOResources"/><br/>
<rich:pickList value="#{ticketCont.workOrder.resources}" var="_resource" listHeight="200px" id="editedWOResources">
<f:selectItems value="#{ticketCont.activeResources}"/>
<f:converter converterId="es.caib.gesma.gesman.data.converter.ResourceConverter" />
<rich:column>
#{_resource.name}
</rich:column>
</rich:pickList>
</div>
</td>
</tr>
</table>
<a4j:commandButton id="createWO" value="Guardar" action="#{ticketCont.saveWorkOrder()}"
render="workOrders,footer" oncomplete="#{rich:component('workOrderPopup')}.hide()"/>
</a4j:outputPanal>
</h:form>
</rich:popupPanel>
now on click the pop is open there in render="editWorkOrderPanal" this is work 4 u..

Show JSF validation error next to the fields

I want to display the error messages beside the text fields.
I am able to show the error message but all the error messages come at once...
<h:form id="LoginForm">
<table>
<tr>
<td colspan="4" id="login">
<h2 style="border-bottom: 1px solid #CCCCCC;">Login</h2>
<tr>
<td class="label">
<h:outputLabel for="email" value="Login Email:"></h:outputLabel>
</td>
<td class="field">
<h:inputText id="email" size="20" maxlength="70" required="true" requiredMessage="Please enter your email,eg:yourid#domain.com" value="#{loginController.selected1.email}"> <f:validateLength maximum="70"></f:validateLength></h:inputText>
</td>
</tr>
<tr>
<td class="label">
<h:outputLabel for="password" value="Password:"></h:outputLabel>
</td>
<td class="field">
<h:inputSecret id="password" size="20" maxlength="50" required="true" requiredMessage="Please confirm your password" value="#{loginController.selected1.password}"><f:validateLength minimum="6" maximum="50"></h:inputSecret>
</td>
</tr>
</td>
</tr>
<tr>
<td>
<h:commandButton value="Login" type="submit" action="#{loginController.checkValidUser()}"></h:commandButton>
</td>
</tr>
</table>
</h:form>
How to modify the code to show error messages beside the text fields?
Just put a <h:message> right there where you need to see it. E.g.
<tr>
<td class="label">
<h:outputLabel for="email" value="Login Email:"></h:outputLabel>
</td>
<td class="field">
<h:inputText id="email" size="20" maxlength="70" required="true" requiredMessage="Please enter your email,eg:yourid#domain.com" value="#{loginController.selected1.email}"> <f:validateLength maximum="70"></f:validateLength></h:inputText>
<h:message for="email" />
</td>
</tr>
or
<tr>
<td class="label">
<h:outputLabel for="email" value="Login Email:"></h:outputLabel>
</td>
<td class="field">
<h:inputText id="email" size="20" maxlength="70" required="true" requiredMessage="Please enter your email,eg:yourid#domain.com" value="#{loginController.selected1.email}"> <f:validateLength maximum="70"></f:validateLength></h:inputText>
</td>
<td class="message">
<h:message for="email" />
</td>
</tr>
Unrelated to the concrete problem, I suggest to have a look at <h:panelGrid>. It minimizes the ugly HTML table boilerplate. Your code would then end up like follows:
<h:form id="LoginForm">
<h2>Login</h2>
<h:panelGrid columns="3" columnClasses="label,field,message">
<h:outputLabel for="email" value="Login Email:" />
<h:inputText id="email" value="#{loginController.selected1.email}" size="20" maxlength="70" required="true" requiredMessage="Please enter your email,eg:yourid#domain.com">
<f:validateLength maximum="70" />
</h:inputText>
<h:message for="email" />
<h:outputLabel for="password" value="Password:" />
<h:inputSecret id="password" value="#{loginController.selected1.password}" size="20" maxlength="50" required="true" requiredMessage="Please confirm your password">
<f:validateLength minimum="6" maximum="50" />
</h:inputSecret>
<h:message for="password" />
<h:panelGroup />
<h:commandButton value="Login" action="#{loginController.checkValidUser()}" />
<h:panelGroup />
</h:panelGrid>
</h:form>

Resources