Showing posts with label Visualforce. Show all posts
Showing posts with label Visualforce. Show all posts

Monday, September 1, 2014

Dynamic Component with Rerender issue

Issue: 


Dynamic Visualforce Component feature causing issues with reRender if the component being reRendered , because of this we will loose the values which was filled in that section in case if we refresh the same section based on Ajax action.

I hope even though if we are using dynamic visualforce components we should have the view state in the partial refresh. Dynamic in the sense is not only just displaying the components on the fly, along with that we should have all the platform features available but we are not getting those. To hold the old values in case of AJAX rerendering we should have our own way of scripting which is bizarre.

I hope salesforce is not doing the dynamic components really dynamic, we should right our own scripts to hold the old values in case of new section creations using dyaminc components feature......

I did my own way of scripting to hold the values and happy to share the solution incase if any one in need.

Here is the information from salesforce
http://help.salesforce.com/apex/HTViewSolution?id=000170864&language=en_US 

Thank you....

Friday, September 27, 2013

Direct download an attachment from a link in Visualforce page

In many cases we need to download a file instead of opening the same.

 A simple HTML5 trick to do the same like below



{!attachment.name}

(this will simply open the file)

 


here main attributes are we should have docType="html-5.0" and download="{!attachment.name}" for the respective components as highlighted above...


Here I used the standard controller you can construct the same using controllers/Extensions to achive the same.



Happy coding...........

Wednesday, August 21, 2013

Drop-down button in a Visualforce Page

creating a drop-down button in a vf page..this is simple hack using standard salesforce styles

Code:
  <apex:page>
  <div class="menuButton" id="MyMenu">
    <div class="menuButtonButton" id="MyMenuButton">
       <span id="menuLabel" tabindex="0" style="">MyMenu</span>
    </div>
    <div class="menuButtonMenu" id="MyMenuMenu">
      <a href="/" class="menuButtonMenuLink firstMenuItem">Left VoiceMail</a>
      <a href="/" class="menuButtonMenuLink">Call in 1 day</a>
      <a href="/" class="menuButtonMenuLink">Call in 3 day</a>
      <a href="/" class="menuButtonMenuLink">Call in 5 day</a>
    </div>
  </div>
<script type="text/javascript">new MenuButton('MyMenu', false);</script>
  
</apex:page>

you can associate the actions by replacing the anchor tags with commandlinks or use ajax


Happy coding.....

Friday, August 2, 2013

Standard Salesforce DatePicker not working?

Some times Visualforce page with rerender sections, that standard DatePicker field based on Date or DateTime inputField tag was not working?

This was happend to me recently when I am developing some vf page. For this, a small hack that we can use is

if you have any field which is date or datetime, try to create the block which executes on every load with out and conditional renderings . This will allow to initialize the script and works for our custom inputField in vf page..

<div style=”display:none”>
    <apex:inputField value=“{!Account.Date_field__c}”/>
</div>


if you don't have any field which is date or datetime on the standard controller then create a property for the extension if you have any(if not you may need to created a date field on the standard controlller..but this doesn't make sense...in order to cover an issue we are not supposed to create  field..) which contains a set up object date or datetime field and make use of the same. like

public opportunity oppObj {get;set;}

<apex:inputField value="{!oppObj.closeddate}" rendered="false"/>

Hope this will help those we stuck with this kind of issue...Thank you.