I've got a progressBar component defined as the following on my webpage:
<rich:modalPanel id="pb1Panel">
<rich:progressBar id="pb1" oncomplete="javascript:#{myBean.handleProgressEvent()} closeProgressModalPanel()" value="#{pb1Listener.percentageComplete}" label="#{pb1Listener.percentageComplete} %" minValue="1" maxValue="100" limitToList="true" timeout="3200" interval="1400" enabled="false"/>
</rich:modalPanel>
and a button:
<a4j:commandButton id="actButton" value="action" action="#{myBean.performAction}" immediate="true" ajaxSingle="true" onclick="javascript:Richfaces.showModalPanel('pb1Panel');" reRender="pb1Panel">
<a4j:support event="onClick" value="#{rich:component('pb1')}.enable()" reRender="pb1" />
</a4j:commandButton>
which doesn't work. However if I take out the
....
enabled="false"/>
....
from the progress bar, and the element from the button, everything seems to work just fine.
Any suggestion why it's not working? I'm setting enabled="false" initially because I do not want the polling to start unless the button was clicked (to reduce unnecessary polling).
The system is building on richfaces/seam.
Thanks!
The enabled property should refer to a property of a managed bean, and your button should change it, then reRender the progress bar.
Simply copy-paste the example from here - it's doing exactly the same thing as you want.
Related
I have been used a custom itemrenderer to build a program needed.
In the itemrenderer it looks like this.
i use to deal with the calse effects when user move mouse over a specific item renderer.
<s:postLayoutTransformOffsets>
<mx:TransformOffsets id="offsets" x.hovered="-10" y.hovered="-15" scaleX.hovered="1.2" scaleY.hovered="1.2" />
</s:postLayoutTransformOffsets>
<s:transitions>
<mx:Transition fromState="normal" toState="hovered" autoReverse="true">
<s:Animate target="{offsets}" duration="200">
<s:SimpleMotionPath property="scaleX" />
<s:SimpleMotionPath property="scaleY" />
<s:SimpleMotionPath property="x" />
<s:SimpleMotionPath property="y" />
</s:Animate>
</mx:Transition>
<mx:Transition fromState="hovered" toState="normal" autoReverse="true">
<s:Animate target="{offsets}" duration="200">
<s:SimpleMotionPath property="scaleX" />
<s:SimpleMotionPath property="scaleY" />
<s:SimpleMotionPath property="x" />
<s:SimpleMotionPath property="y" />
</s:Animate>
</mx:Transition>
</s:transitions>
After that is the script part deal with the event or logic with the renderers.
For each render there will have to buttons contained in the renderer and showed only when user move mouse on the renderer, each button can trigger a event to deal with.
the last part code is about the container in the renderer.
First is a which have a "rollOver" and "rollOut" event, when user rollOver a button and click it the event will executed. same to the rollOut.
Inside the Group there is a image bound with the pictures that will be show in the renderer.
A Hgroup contains the button that with the Event to execute when user click on it.
The problem i have been meet is:
1. the states is not controllable, when user move mouse over a render and do the click, other itemrenderer will do the scale as well. that the sates problem and i have override the getcurrentstates method to fix that,that works but
2. after fix the itemrenderer states problems i found the other itemrender which is not clicked by users also can execute the rollOver event, which is pretty wired.
I'm not sure if this problem is also about the states of itemrenderer or it is about something else i don't have a idea.
Hope someone can help me find some clues and solutions , or maybe just suggestions that could be helpful.
cheers.
This is because the item renderers are being reused for other items in the list, and when being reused, they maintain the previous state they were.
You should set the state of the items to the default one if they are being reused. Do that by overriding the "set data" function, however you will have to disable the transitions, otherwise they would be played too.
i am using following code to popup a login panel whenever i click on some specific button.
the problem is the login panel sticks it should be non visible again if i click somewhere else on screen. Anyone got ideas how to do that.
<s:Animate id="anim" targets="{[loginPanel]}" duration="1000">
<s:SimpleMotionPath property="alpha" valueFrom="0.0" valueTo="1.0" />
<s:SimpleMotionPath property="moveByY" valueBy="2"/>
</s:Animate>
<mx:Button includeIn="Login" x="811" y="10" height="53" width="142" id="btnLoginStatus" icon="#Embed(source='assets/LogIn.jpg')" click="{ if(loginPanel.visible==true) {loginPanel.visible=false; loginPanelClicked = false;} else loginPanel.visible=true; mainViewStack.selectedIndex =0; anim.play(); loginPanelClicked = true;}" />
its all fine now add click = "loginPanelClicked = true " in bordercontainer of your login panel.
Try writing a method in a script block and link that function to the click property instead of inlining it. Can't tell from the code you provided what the method is supposed to actually do. It looks like it will play the animation regardless if the login panel is visible or not, and it will cause the login panel to always show (alpha=1.0 hint, hint).
If you write it out in a method instead of inlining it I think you'll spot your error with the else statement.
I have some web page with some content and a button. What I would like to do is to implement such behaviour:
User is pressing the button.
Before any time consuming operation starts, animation appears.
2a. Animation must be on the top of the page. I do not want to underlying page dissapear for the time when some data is processed.
Data processing is finished, animattion is hidden and page is re-rendered.
I do not want to use jQuery to achieve this and the animation must work on IE and Firefox.
I am using Ajax Control Toolkit library and I whish to avoid any other external libraries.
How to do this? My first and only idea so far is to put whole page on the UpdatePanel and then put somehow UpdateProgress on top of it.
How about setting up an animation target? Inside each animation definition in the UpdatePanelAnimationExtender?
<Sequence>
<EnableAction Enabled="false" />
<Color AnimationTarget="MyContent"
Duration="1"
StartValue="#FF0000"
EndValue="#666666"
Property="style"
PropertyKey="backgroundColor" />
<Color AnimationTarget="MyContent"
Duration="1"
StartValue="#FF0000"
EndValue="#666666"
Property="style"
PropertyKey="backgroundColor" />
<EnableAction Enabled="true" />
</Sequence>
I'm writing a Flex application and I came across what I think is a weird problem.
I want to create a text box and a DateChooser as the datefield didn't do what I wanted and it's Halo so I can't skin it easily. I want the DateChooser to show when I click on the text input. Here is an except from my code:
<s:TextInput id="wholeDate" width="100"
mouseOver="stopChangeToNormal();"
paddingRight="10"
click="date1.visible = true"
focusOut="date1.visible = false"/>
<s:Button label="Go" width="70" />
</s:Panel>
<mx:DateChooser id="date1"
visible = "false"
change="useDate(event);"
mouseOver="changeToNormalState = false;"
y="{wholeDate.y + buttonsGroup.y + 20}"
x="{wholeDate.x + buttonsGroup.x - 175 }" />
The weird thing is that it works if I make it visible = "true" to start, but if I have it visible="false" it doesn't work! It shows, but the date I select doesn't show in the box as it does if I have it as visible="true", but I don't want it to be visible initially.
Any ideas?
I don't think its actually anything to do with the initial visibility of the DateChooser. Have you verified that your event handlers are indeed called, and in an order that makes sense? The problem appears to be that when you attempt to make a selection in the DateChooser, the TextInput gets a focusOut event, which hides the DateChooser, which apparently prevents it from receiving the selection event. I think you need to be more selective about when you actually hide the DateChooser. Perhaps you need to defer the hiding so it has a chance to respond to the selection first.
I have a gridview that is within an updatepanel for a modal popup I have on a page.
The issue is that the entire page refreshes every time I click an imagebutton that is within my gridview. This causes my entire page to load and since I have grayed out the rest of the page so that the user cannot click on it this is very annoying.
Does any one know what I am missing.
Edit: I entered a better solution at the bottom
Make sure you have the following set on the UpdatePanel:
ChildrenAsTriggers=false and UpdateMode=Conditional
do you have ChildrenAsTriggers="false" on the UpdatePanel?
Are there any javascript errors on the page?
I had this problem and came across the following article:
http://bloggingabout.net/blogs/rick/archive/2008/04/02/linkbutton-inside-updatepanel-results-in-full-postback-updatepanel-not-triggered.aspx
My button wasn't dynamically created in the code like in this example, but when I checked the code in the aspx sure enough it was missing an ID property. On adding the ID the postback became asynchronous and started to behave as expected.
So, in summary, check your button has an ID!
Are you testing in Firefox or IE? We have a similar issue where the entire page refreshes in Firefox (but not IE). To get around it we use a hidden asp:button with the useSubmitBehavior="false" set.
<asp:Button ID="btnRefresh" runat="server" OnClick="btnRefresh_Click" Style="display: none" UseSubmitBehavior="false" />
Several months later this problem was fixed. The project I was working in was a previous v1.1 which was converted with 2.0. However, in the web.config this line remained:
<xhtmlConformance mode="Legacy"/>
When it was commented out all of the bugs that we seemed to have with the ajax control toolkit disappeared
Is the Modal Window popped up using the IE Modal window? Or is it a DIV that you are showing?
If it is an IE Modal Pop up you need to ensure you have
<base target="_self" />
To make sure the post back are to the modal page.
If it is a DIV make sure you have your XHTML correct or it might not know what to update.
I would leave the onClick and set it as the trigger for the updatePanel.
That's odd that it works in FF and not IE. That is opposite from the behavior we experience.
UpdatePanels can be sensitive to malformed HTML. Do a View Source from your browser and run it through something like the W3C validator to look for anything weird (unclosed div or table being the usual suspects)
If you use Firefox, there's a HTML validator Extension/AddOn available that works quite nicely.
For reference..
I've also noticed, when using the dreaded <asp:UpdatePanel ... /> and <asp:LinkButton ... />, that as well as UpdateMode="Conditional" on the UpdatePanel the following other changes are required:
ViewStateMode="Enabled" is required on <asp:Content ... /> (I've set it to Disabled in the MasterPage)
ClientIDMode="Static" had to be removed from <%# Page ... />
To prevent post-backs add return false to the onclick event.
button.attribute.add("onclick","return false;");
Sample:
string PopupURL = Common.GetAppPopupPath() + "Popups/StockChart.aspx?s=" + symbol;
hlLargeChart.Attributes.Add("onclick", String.Format("ShowPopupStdControls(PCStockChartWindow,'{0}');return false;", PopupURL));