Launching a clientListener method after a table is rendered

This ought to be simple, but it has me baffled. I find some data, build a list, render my table, and then I want to call a JavaScript function to do some client side work. If I put a action clientListener on the commandButton I use to create the dataset, it gets called before the data set is created; I need something that will get called after the data is loaded. I think I need something that will do exactly what
<af:table>
  <af:clientListener method="doSomething" type="sort"/>
</af:table>does but gets called when the table is first rendered.
Thanks, Mar.

Thanks, this works.
I was concerned that I'd beat my page render back but that is not the case, by the time my JavaScript is called the <af:clientAttributes> specified as the last embedded components of the <af:table> are all valid.
NOW ...
The problem is that sometimes I do this from inside a PhaseListener. We had been catching the PhaseId.RESTORE_VIEW but the FacesContext.currentInstance() at that phase Service.getRenderKitService throws a FacesContext.getRenderKit() returned null while trying to get the org.apache.myfaces.trinidad.render.ExtendedRenderKitService service;  please check your configuration message.
The only PhaseId that is able to get a ExtendedRenderKitService is PhaseId.RENDER_RESPONSE. However, when I call
  public static void addScript(String javaScript) {
    FacesContext context = FacesContext.getCurrentInstance();
    try {
      if (context != null) {
        ExtendedRenderKitService service = Service.getRenderKitService(context, ExtendedRenderKitService.class);
        if (service != null) {
          service.addScript(context, javaScript);
    } catch (Exception e) {
      getLogger().equals(e.getLocalizedMessage());
  }I can successfully addScript but the script never gets called. I wait at my break-point in Firebug and it is not hit.
So, this works fine when the normal life-cycle is operating but when I am capturing input from a PhaseListener (which I do to perform Ajax requests within the ADF context) I'm not able to find the appropriate service. Any further ideas (the first one was great) that might help me over this final gotcha?
Thanks, Mark
P.S. I need to launch some of these requests from JavaScript (hence the Ajax and PhaseListener) because I'm gathering information from an Oracle Maps div; I click locations on the map to add items to my table. msm
Edited by: mmillman on Feb 24, 2009 2:47 PM

Similar Messages

  • How to call a javascript method after table load on JSFF Fragment load?

    Hello,
    The usecase is to invoke a javascript method after table is done loading (fetching data) when user lands to a JSFF fragment. With JSPX pages I can achieve that by using PagePhaseListener. I have tried with RegionController as follows, and the problem i face is that I cannot prevent multiple calls to the Javascript call when user presses a tab or button in a screen, or changes drop-down value with autosubmit on.
    import javax.faces.context.FacesContext;
    import oracle.adf.model.RegionBinding;
    import oracle.adf.model.RegionContext;
    import oracle.adf.model.RegionController;
    import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
    import org.apache.myfaces.trinidad.util.Service;
    public class MyListener implements RegionController{
    public MyListener() {
    super();
    @Override
    public boolean refreshRegion(RegionContext regionContext) {
    int refreshFlag = regionContext.getRefreshFlag();
    System.out.println("Render flag is: "+refreshFlag);
    if (refreshFlag == RegionBinding.PREPARE_MODEL)
    initializeMethod();
    regionContext.getRegionBinding().refresh(refreshFlag);
    return false;
    public boolean validateRegion(RegionContext regionContext) {
    regionContext.getRegionBinding().validate();
    return false;
    public boolean isRegionViewable(RegionContext regionContext) {
    return regionContext.getRegionBinding().isViewable();
    public void initializeMethod() {
    FacesContext f = FacesContext.getCurrentInstance();
    ExtendedRenderKitService service = Service.getRenderKitService(f, ExtendedRenderKitService.class);
    service.addScript(f, "myJSFunction();");
    @Override
    public String getName() {
    return null;
    I need the javascript to be called only once after the table is done loading when user lands to a fragment (jsff).
    Any ideas appreciated?
    JDeveloper version is 11.1.1.5.0
    Thank you.
    Valon
    Edited by: Valon on Apr 11, 2013 3:10 PM

    One of the requirements is to compare every row with the next row and highlight the changes. There are other requirements as well where JavaScript solution is used.
    The question remains the same. Is it doable or not without changing the solution from JavaScript solution to server-side solution ? Can we call a JavaScript only once when the user lands to a jsff fragment ?
    Hope that is clear.
    Thanks.
    Valon

  • Adf faces: execute bean method after table is loaded

    Hi,
    How can I execute a method after an adf table is rendered on the page?
    This is what I want to do:
    I have a master/detail:
    - the master part contains a list of materials
    - the details contains a list of customers and volumes depending on the selected material.
    I tried to add totals on the details table:
    - I created an output text in the footer-facet of the colums containing volumes
    - I created a binding of the detail table to a CoreTable.
    - I created a method in a managed bean related to this CoreTable binding, so I can browse to all rows in the table and calculate the sum.
    - I then set the value of the output text to the total calculated in the managed bean.
    the problem is that I don't know how to execute the calculate procedure after the data in the detail table exists.
    What I tried:
    - call the calculate procedure in the setCoreTable method. --> at this point, there is no data in the table and this results in a nullPointerException when the pages is loaded.
    - call the calculate procedure on the valueChangeListener of the material list --> this doesn't work because totals are calculated for the previous details set.
    - I tried to add the call in one of the table listeners but I cannot find a listener that is executed after data is loaded in the table...
    for testing purpose only, I added a button: calculateTotals that calculates the totals. This works correctly.

    Hi,
    if you use page fragments exposed in an ADF region, you have two options I see
    1. Use a method call activity to call the managed bean
    2. Use a hidden UI component that references the setter/getter exposed in a managed bean and just use this as an indication for the page fragment being loaded
    Keragala

  • Calling a backing bean method after load of fragment in adf

    I needed to call a backing bean method after page load of fragment in adf.
    I used the method suggested in:
    https://community.oracle.com/message/11044570
    only difference is im giving the if clause as:
    if (refreshFlag == RegionBinding.RENDER_MODEL ) {
    instead of
    if (refreshFlag == RegionBinding.PREPARE_MODEL)
    It was working fine, but page was not getting refreshed so used the code as mentioned in example:
    public void refresh() {
              FacesContext facesContext = FacesContext.getCurrentInstance();
              String refreshpage = facesContext.getViewRoot().getViewId();
              ViewHandler  viewHandler =facesContext.getApplication().getViewHandler();
              UIViewRoot viewroot =  viewHandler.createView( facesContext, refreshpage);
              viewroot.setViewId(refreshpage);
              facesContext.setViewRoot(viewroot);
    Now issue is once page is loaded and backing bean method is called, the refresh code refreshes the page and upon page load, refresh method is called again in recursive fashion.
    please advise what to do in such scenario?
    I tried to do selective refresh using some variable(also with static) but it does not help as page wont be refresh at all or page will keep refreshing recursively.

    Use clientListener on the page load event
    <af:document id=”d1″>
        <af:serverListener type=”onloadEvent”
                           method=”#{<managedbean name>.<method name>}”/>
        <af:clientListener method=”onLoadClient” type=”load”/>
        <af:resource type=”javascript”>
        function onLoadClient(event) {
          AdfCustomEvent.queue(event.getSource(),”onloadEvent”,{},false);
          return true;
        </af:resource>

  • Bridge does not launch any PS-Script after upgrade to 1.0.2

    Hi,
    there are some communication problems between Bridge and Photoshop CS2 after upgrading Bridge to 1.0.2:
    1) If i choose e.g. the imageprocessor or any other PS-Script via the Bridge menu then PS will be launched, but the sript won´t be started in PS. That means that PS is activated by the command but that´s all...
    If i launch the script via PS there is no Problem.
    2) If i activate "Double Click edits Camera Raw Settings in Bridge" in the Bridge Preferences the image will launch Camera Raw but after that it will not open the image in PS. If i deactivate this then Camera Raw starts PS and it opens the image without any Problem.
    Before the upgrade to 1.0.2 it worked perfectly. Deinstalling and reinstalling the old Version does not help.
    Even reinstalling PS and all the components does not work at all... (
    System is Windows XP
    Preferences of Bridge and PSCS2 are resetted.
    This is a cross posting. I added this topic yesterday in the "Bridge Forum" but nobody there seems to have such a problem, so i started this thread here again...
    It´s really a big problem.
    Thank you in advance!!
    theo

    I'm not sure - I'm trying to script Bridge to hand off a file to PShop and run a script using the cross-DOM method. It opens the files, but I can't get it to run the script.
    Still working on it - will try messaging method next, I guess.
    The samples aren't there, so I'm running blind, a bit.
    rickb

  • Calling a method after 10 seconds

    Hello,
    I need to call a method after 10 seconds. That is to make sure that if one particular field is updated, say 3 times in a window of 10 seconds, I should just be able to take the last value and process it, in my ajax app. I am so far using the Timer class, but the problem is, it ticks off a thread for every single request to be processed after 10 seconds and processes all the 3 requests, where as I should just be running that method once for the last request. Could you please help me with this ?
    Cant do this at the client level, for the page may be closed within those 10 seconds of the event and the setTimeout wont work then.
    This is what I made so far.:
    final Map<String, Object> mp = new HashMap<String, Object>();
    if(form.getEmpId() != null )
                mp.put(form.getEmpId().toString(), form);
                new java.util.Timer().schedule(new java.util.TimerTask()
                   public void run()
                      EmpForm form1 = (EmpForm)mp.get(empId.toString());
                      String empId = form1.getempId().toString();
                      String value1Changed = form1.getValue1Changed().toString();
                      String value2Changed = form1.getValue2Changed().toString();
                      myService.changeData(empId, value1Changed, value2Changed),
                }, 10000);
             }

    Thanks for replying
    tjacobs01 wrote:
    My recommendation is that you share an AtomicReference between your timer and the listener that is receiving the updates. This way, the listener can just update the value, and the timer uses the latest one when it wakes upOk, out of my limited understanding, I looked up AtmoicReference and found it a class. I think I cant use that since I am maintaining a list of empIds against the object that holds their data in a hashmap, expecting the map to override the empId on the second request. So, I made a final map and thought Id just push the timer scheduler method in another method, but the problem is, for me to ask that thread (which I expect to run after 10 seconds of my calling) to run, I need to call it somewhere, and as soon as I get a request I am calling the method which runs/ticks off the thread.
    I was thinking that since I am passing and using a final map (that I declared as a class level variable), I will be able to put update the map object and whenever the thread runs, will fetch the latest value (of the empId) in the map. But I guess I am doing it wrong. :(

  • Can you create more tables in a document after the table of contents?

    I am writing my thesis and after my table of contents I need to put in another table which lists the figures and their page numbers and also a list of tables and their page numbers

    Be aware that the T.O.C. will only list the captions of the figures and they must not be in floating or inline textboxes.
    You can do 2 passes to get what you want. Create a TOC for the figures, export that and reimport it into Pages as text, then get rid of the TOC that forrmed that, then do another TOC for the main text.
    Peter

  • In SQ02 after joining table if we want write condition on other field how ?

    In SQ03 after joining table if we want write condition on some fields
    for filtering records then what is the procedure.

    Please check forum subject. This is not a right forum for your question. Close your thread and post it on a proper forum.
    Thanks,
    Gordon

  • Stop a method after catching an exception

    I'm facing the following situation.
    I have a method that is used in the actionPerformed from a JButton.
    In this method there is a try block:
    try{
        sl1 = Integer.parseInt(Text1.getText());
        gh1 = Integer.parseInt(Text2.getText());
    }in the catch block i handle a NumberFormatException if there is one.
            catch(NumberFormatException e){
                e.printStackTrace();
                headerLabel.setText("Use numbers only");
            }However, i call several other methods after the try / catch block.
    I only want this to happen when there isn't an Exception.
    Example:
      private void buttonAction(){
          try{
              //Do something
          catch(Exception e){
              e.printStackTrace();
          //Do this if there isn't an Exception
          method1();
          method2();
      }What is the "common" way to handle this situation?

    Encephalopathic wrote:
    One way: Put method1 and method2 in your try block at the bottom, under the line that can cause the exception. e.g.,
    private void buttonAction(){
    try{
    //Do something
    //Do this if there isn't an Exception
    method1();
    method2();
    catch(Exception e){
    e.printStackTrace();
    }Then you can see at a glance that these methods are not supposed to run if the exception is tripped.
    Edited by: Encephalopathic on May 1, 2010 5:46 AMOk, so if there's an Exception, the complete try block is reversed?
    Can i compare it to a ROLLBACK in sql?

  • Unable to access Web Method after deploying into the server

    Hi,
    I'm Unable to access Web method after deploying into the server.
    My Web method is 
    [WebMethod]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json )]
    public object getOwners()
    DataTable dt = _qbObj.returnDDLData("employeedetails", "EmpID", "EmpFirstName");
    if (dt == null)
    return new { Result = "Error", Options = "Error getting data" };
    string[] strAttributes = { "ID", "Name" };
    string[] strColName = { "EmpID", "EmpFirstName" };
    List<SolOwners> lstObject = convertToList(dt, strAttributes, strColName, new SolOwners());
    var owners = lstObject.Select(c => new { DisplayText = c.Name, Value = c.ID });
    return new { Result = "OK", Options = owners };
    When I.m accessing that method after deploying into server, I got following error.
    System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: &lt;&gt;f__AnonymousType9`2[System.String,System.Collections.Generic.IEnumerable`1[&lt;&gt;f__AnonymousTypea`2[System.String,System.String]]] cannot be serialized because it does not have a parameterless constructor.
    at System.Xml.Serialization.TypeScope.GetTypeDesc(Type type, MemberInfo source, Boolean directReference, Boolean throwOnError)
    at System.Xml.Serialization.XmlSerializationWriter.CreateUnknownTypeException(Type type)
    at System.Xml.Serialization.XmlSerializationWriter.WriteTypedPrimitive(String name, String ns, Object o, Boolean xsiType)
    at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write1_Object(String n, String ns, Object o, Boolean isNullable, Boolean needType)
    at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write71_anyType(Object o)
    at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
    --- End of inner exception stack trace ---
    at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
    at System.Xml.Serialization.XmlSerializer.Serialize(TextWriter textWriter, Object o, XmlSerializerNamespaces namespaces)
    at System.Web.Services.Protocols.XmlReturnWriter.Write(HttpResponse response, Stream outputStream, Object returnValue)
    at System.Web.Services.Protocols.WebServiceHandler.WriteReturns(Object[] returnValues)
    at System.Web.Services.Protocols.WebServiceHandler.Invoke()Please help me to solve that issue.Thank you.

    Hi Vani,
    What project are you developing? According to your code looks like an Asp.Net application? Am i right?
    If so , please repost in  ASP.Net Forum
    http://forums.asp.net for more efficient responses.
    This forum is discuss problems of C# development.
    Have a nice day!
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Siri won't launch on new ipad after iOS 6 install

    I can't get Siri to launch from home button after iOS 6 install on the new iPad with Siri turned on in settings menu. Any Ideas?

    Not sure, did you hold down the home button? That's how to get Siri to pop up? And your lucky, iOS 6 won't even install on my iPad 3, any suggestions?

  • Trigger a backing bean method after selection on select one choice

    Hi all,
    I'm new to Jdeveloper 11g, and I'm trying to trigger a method after the user makes a selection on a "select one choice" (JSF page).
    I have a method (backing bean) that reads the selection and executes a procedure that retrieves some data and fills that on Input Text A and B, unfortunately this is implemented using an af: button and I would like this method to trigger automatically after the user makes the selection without clicking the button. Can you help me?
    Thanks,
    Mike.

    Thanks for your response, your suggestion does what I asked, it fires the procedure but now the code does not work, for some reason the variable "clientListIndex" is null, but if I place the code in a method associated with a button it works. Any suggestion?
    public void onChangeCliente(ValueChangeEvent valueChangeEvent) throws SQLException {
    if(valueChangeEvent.getNewValue() != null){  
    DCBindingContainer dcBinding =
    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCControlBinding listControlBinding =
    dcBinding.findCtrlBinding("NameSourceList");
    FacesCtrlListBinding listBinding = (FacesCtrlListBinding)listControlBinding;
    if (clientListIndex != null){
    Row row = listBinding.getRowAtRangeIndex(Integer.valueOf(clienteListIndex));
    String enquiryListCode = row.getAttribute("Cvecliente").toString();
    else{
    System.out.println("null value");
    }

  • Query is not running after one table exceeds certain records, any limit?

    I have a production database and a reporting database. Production is on version 9.2.0.5 where as Reporting is on 9.2.0.3. I had a query which uses Gl table which grows every month. The query use to take almost same time both in Production as well as Reporting. After the table grew in last couple of months. I observed the query just hangs up in production where as it continues to run in Reporting. Is it the orcale version which makes any difference for the query not to run in prodcution when Gl table had 27 million rows as against 25 million rows a couple of months of ago? Any help is appreciated.

    user5846372 wrote:
    If I use the gl table which was populated until two months ago having less than say 25.2 million rows, the query runs in 2 minutes. If I use the current gl table having current data (total of say 27 million rows) then the query does not even run. From the current gl table if I delete about 2 million records making it 25 illkion rows then the query runs. So I was wondering whether it is the oracle version which makes this difference.Explain your logic that says that after the queries run successfully on different versions, the version difference is now somehow causing the problem - and not the fact that what did change since the last successful run was the the data volumes....
    As for "+the query does not even run+" - it does. Simply that you do not have a clue what it is doing and thus no means to diagnose the problem. And then jump to the conclusion that the version difference is somehow to blame.
    WHAT is that query doing when it seems to "hang"? (it very likely does not hang at all, and is simply very busy with I/O or being blocked from accessing a resource it needs)
    Have you looked at the events and wait states of the query? Have you looked, as Daniel already suggested, at the execution plan?
    You cannot and should not attempt to diagnose a problem, without understanding the problem. If you have no idea what the problem is, how can you simply jump to the conclusion that "+oh, it must be the version difference+"!?
    You can only solve a problem by understanding it. It is that simple. So first understand what the query is doing and why it seems to hang BEFORE you attempt to diagnose and solve it.

  • How to Use Methods AFTER Work Item Execution (Modal Call)

    Hi,
    Need to execute a piece of code after a decision based on the result.
    Hope this can be done using Methods After WorkItem Execution
    Can anyone give some idea about how to use this.
    Regards
    Imman

    Hi Mike,
    I have a common piece of code that has to get executed irrespective of the decision made,but after the decision.
    Imman

  • How to execute a method after page Load?

    My question is very similar to what was discussed in following thread:
    How to execute a method after page Load?
    My requirement is that I want to run a method in backing bean of a page, immediately after the page gets loaded. In that method I want to invoke one of the method action included in the pagedef of this page, conditionally.
    I tried using the approach given in the above thread, i.e to use <f:view afterPhase="#{backing_security.setPermPriv}">, but the problem is that our page is not using 'f:view' , so I explicitly added one f:view with afterPhase property set , but it is not working, page it self is not getting loaded, it is throwing the error:
    Root cause of ServletException.
    java.lang.IllegalStateException: <f:view> was not present on this page; tag [email protected]e8encountered without an <f:view> being processed.
         at org.apache.myfaces.trinidad.webapp.UIXComponentELTag.setProperties(UIXComponentELTag.java:108)
         at javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:733)
         at javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:1354)
         at org.apache.myfaces.trinidad.webapp.UIXComponentELTag.doStartTag(UIXComponentELTag.java:71)
         at oracle.adfinternal.view.faces.taglib.UIXQueryTag.doStartTag(UIXQueryTag.java:41)
         at oracle.adfinternal.view.faces.unified.taglib.UnifiedQueryTag.doStartTag(UnifiedQueryTag.java:51)
         at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:50)
         at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:262)
         at oracle.jsp.runtime.tree.OracleJspNode.execute(OracleJspNode.java:89)
         at oracle.jsp.runtimev2.ShortCutServlet._jspService(ShortCutServlet.java:89)
         at oracle.jsp.runtime.OracleJspBase.service(OracleJspBase.java:29)
         at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:665)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:387)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:822)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:746)
    Please help to resolve this issue, or am I doing anything wrong?

    Hi,
    I assume that your view is a page fragment and here - indeed - the f:view tag cannot be used. If you use ADF then one option would be to use a custom RegionController on the binding layer to listen for the render phase to invoke the method. Another option would be to use a hidden field (output text set to display="false" and have this component value referencing a managed bean property. The managed bean property's getter method can now be used to invoke the method you want to run upon view rendering
    Frank

Maybe you are looking for

  • Can't transfer itunes to ipod

    I can't transfer any of my musit in iTunes to my ipod anymore.  I've tried everything. 

  • HP Officejet Pro 8000 A809 continues to disconnect my wireless internet connection

    My router is a Netgear WNDR3400 v2 My Desktop is running Windows XP Pro My laptop is running Windows 7 Home Ever since I turned on the wireless function of the printer, I intermittently lose my internet connection, both wired(ethernet) and wireless. 

  • HELP!! ERROR IN reading from file!! (PART of )PROGRAM

    Take a look at my program first.... import java.io.*; public class reading_file { public static void main(String[] args) throws IOException { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); String [] sType= new String[10]; int

  • AD Replication Not Working - Last error: 1256 (0x4e8):

    Hi, We have one DC and ADC which is running on the same premises.  Few days back the ADC got power failure and after that long it thrown an error of some services are not started.  We checked the event viewer to find out the service failed but not fo

  • I want to change my ipad wifi to wifi 3G

    today i got my ipad from my uni. but this is a wifi model. Can i go to Apple store pay the extra money change to wifi 3G? because my ipad still fully packed up. Not open yet. thx for answer my question.