Generating dynamic command links in data table

Hi,
I have a requirement to generate dynamic number of columns in a datatable. Also these columns should contain a command link.
I have written following piece of code to do so...
public UIData getDataTableBinding()
     UICommand comm = null;
     UIColumn col;
     UIOutput out = null;
     Application app = app = FacesContext.getCurrentInstance().getApplication();
// Suppose I want to generate 7 columns
     for(int j = 0; j < 7; ++j) {
     out = new UIOutput();
     col = new UIColumn();
     comm = new UICommand();
     ValueBinding vb = app.createValueBinding("#{" + j + "}");
     out.setValueBinding("value", vb);
     out.setRendererType("javax.faces.Text");
     comm.setRendererType("javax.faces.Link");
comm.getChildren().add(out);
     MethodBinding mbButton = app.createMethodBinding("#{pc_File1.doLink1Action}",
null);
     comm.setAction(mbButton);
     col.getChildren().add(comm);
     dataTableTemp.getChildren().add(col);
     return dataTableTemp;
I have bound the "binding" attribute of the data table to getDataTableBinding()
method.
If I remove all the references to UICommand i.e comm variable, table is displayed properly, but if
I try to include a command link component as mentioned above I get "Assertion failed error"
SRVE0068E: Could not invoke the service() method on servlet Faces Servlet. Exception thrown :
javax.servlet.ServletException: javax.faces.el.EvaluationException: Error getting property
'dataTableBinding' from bean of type pagecode.File1: javax.faces.FacesException: Assertion Failed
     at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:638)
     at com.ibm._jsp._File1._jspService(_File1.java:92)
     at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:88)
Any kind of help on this issue would be appreciated,
Thanks in advance,
Raina

Hi,
I solved my problem just by replacing UIOutput component with HtmlOutputText component and then making it as a child component of UICommand component.
Now I am facing a new problem. Whenever I try to refresh the page I get following exception
"SRVE0026E: [Servlet Error]-[Faces Servlet]: java.lang.IllegalStateException: Duplicate component ID 'form1:table1:cmd0' found in view."
I am explicitly setting the component id of the UICommand component using the setViewId() method.
This problem is observed only when I refresh the page. In case I navigate to another page and then again come back to this current page, then I don't get this exception.
Your help would be appreciated,
Raina

Similar Messages

  • Add Command when selecting data tables

    I've been playing with the Add Command option that allows you to enter an SQL statement to select data for the report.  I was wondering what people use this type of command for?  I've used Crystal over 10 years but while I've been using Crystal XI for only about 3 years, I have never used this option.
    So what advantages does it have over the graphically selection and linking of data tables?
    What types of reporting is usually done with them?
    TIA, rasinc

    You have to know your database well and have fairly good SQL skills, but I've found that there are things I can't do directly in Crystal that I can do when I use a command as the data source.  A couple of examples are:
    1.  When I want to use cross-server joins (MS SQL) or dbLinks (Oracle) to get data from a second (or third!) database, this is the only way to do it short of using a stored procedure, which has it's own issues.
    2.  When I want to do something complex in the SQL, such as using a set of selects with Unions to "pivot" data without using a cross-tab.
    Also, Crystal doesn't always create the most efficient SQL so if I'm having problems with query performance in a report, I'll re-write it using a command so that I can tweak the performance.
    -Dell

  • Command Link in ADF table is not working/ PPR event not getting fired

    Hi All,
    I am having ADF Table, in that one column is with command link if click on command link, it is not navigating to corresponding page or method of a bean. If i give same command link out of the table it working fine, this issue i am facing is in IE9.
    if i use IE in compatibility mode the links works fine, even in IE8 version also.
    Browser: IE 9
    Jdev version: 11.1.1.5.0
    I tried all possible things, but nothing workout for me.
    showPopupBehavior not working in IE9 for af:table buttons (jdev11.1.1.5.0)
    Partial page rendering not working in ie9
    Command Link in ADF table is not working
    Thnks

    Hi,
    please file a bug if you have a customer support contract and provide a testcase
    Frank

  • Getting selected row for command link in af:table

    Hi
    I have a h:commandLink in a column of my af:table. When it is clicked, I need to get the selected row data.
    I know the documentation says use setCurrentRowValue method, but I am not using the Data Control Palette - I get the data fromt the database using code in the BackingBean.
    Is there any other way? Pls help.

    Yes, I got it. But my method gets the data in the selected row, not the rowKey
    First I used af:commandLink instead of h:commandLink and then used af:setActionListener based on an example in the jDeveloper Help. I had to change it a bit since I am not using DCP or bindings.
    This is the sample from Help, hope it helps!
    SF Page Code for a Command Link Using a setActionListener Component <af:commandLink actionListener="#{bindings.setCurrentRowWithKey.execute}"
    action="edit"
    text="#{row.svrId}"
    disabled="#{!bindings.setCurrentRowWithKey.enabled}"
    id="commandLink1">
    <af:setActionListener from="#{row.svrId}"
    to="#{userState.currentSvrId}">
    </af:commandLink>

  • Dynamic change link to data base

    Hello.
    I have project with 40 pages, in each page I have SQL request , like "select * from table@dbtest". I want dynamically change link to my test data base on to real data base.
    What should I do for that would when I selecting another base, link to data base changed in all SQL requests?

    Personally, I'd rather create a synonym yourtable=yourtable@dblink, and just use 'select * from yourtable' in Apex pages. You could also create view yourtable=select * from yourtable@dblink. I usually like to have a DB link named in a meaningful way, so that I know where it's pointing just by looking at the name.
    I usually start with a local table to get Apex to read the structure, and then just replace that with a synonym or view later.
    Edited by: maceyah on Jan 12, 2012 11:38 AM

  • Command link in adf table is not working..

    Hi All,
    I am having ADF Table, in that one column is with command link and,if click on commnad link it is not going to coorsponding action or actionListener methods of bean. If i give same command link out side of the table it working fine.But i have to pass some perameters on click of button.
    I am getting same problem in many places , if i delete the page and page-def files again if i create some times it is working but some times not working. Is there any specific reason for this.Following is the code snippet...
    <af:column sortProperty="GlobalDealId" sortable="false"
    headerText="#{bindings.DsaDealsResultsVO1.hints.GlobalDealId.label}"
    id="c8">
    <af:commandLink text="#{row.GlobalDealId}" id="cl1" action="#{pageFlowScope.editProfileCompleteness.sample}" immediate="true" partialSubmit="true">
    <af:setActionListener from='"#{row.GlobalDealId}"'
    to='"#{pageFlowScope.globalDealId}"'/>
    <af:setActionListener from='"#{row.CustName}"'
    to='"#{pageFlowScope.custName}"'/>
    <af:setActionListener from='"#{row.IsSaDeal}"'
    to='"#{pageFlowScope.isSaDeal}"'/>
    </af:commandLink>
    </af:column>
    Even i tried with out immediate="true" partialSubmit="true" also.
    And i set ChangeventPolicy = ppr for Iterator in page defnation file.
    Awaiting for ur reply.

    Hi,
    the real problem of the original poster seems to be <af:commandLink text="#{row.GlobalDealId}" id="cl1" action="createMDM" immediate="true" partialSubmit="true"> having immediate set to true in which case the request goes from restore view to render response. You usually use immediate=true on a command item to cancel an action (bypassing all the other JSF lifecycle steps).
    Peter551059,
    you don't give us much information about your case. So if the problem is IE9 and you verified IE9 is supported for the version of JDeveloper you use, then - in case you have a support contract - my best advise is to file a service request and have support looking at it just in case you hit a defect that should be filed as a bug
    Frank

  • FOR XML to generate dynamic script to drop multiple tables

    Log_Table has a column named Col1 where we have table names
    Col1
    TableA1
    TableA2
    TableA3
    TableB1
    TableC1
    TableC2
    Generate dynamic script to drop tables that are in Log_Table and starts with TableA.
    Instead of using the loop, use For XML

    Thanks Visakh16 [+1],
    you are right there was typo mistake :-) I forgot the variable in the end, and Thanks Naomi [+1],
    this is true and better to use quotename or just add brackets. Actually I will not choose this approach since we chould use schema as well. the DDL in the OP is not something that I will create probably.
    In any case, here is the fixed query (current approach):
    declare @SQLString NVARCHAR(MAX)
    SELECT
    @SQLString = (select
    N'IF OBJECT_ID (N''' + CAST([Col1] AS VARCHAR(MAX)) + N''') IS NOT NULL drop table [' + CAST([Col1] AS VARCHAR(MAX)) + N']; '
    FROM Log_Table
    WHERE (Col1 like 'TableA%')
    FOR XML PATH (''))
    --print @SQLString
    EXECUTE sp_executesql @SQLString
    GO
      Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]

  • COMMAND LINKS IN TREE TABLE DOESN'T ALLOW CONTEXT MENU TO SHOW UP

    I have a tree table with some columns, the "nodeStamp" facet has a column
    which has the tree with an image and a command link. when i try bringing up
    the context menu from anywhere on the table including the image the context
    menu comes up fine. But when i try bringing up the context menu from the
    command link it doesn't show/come up. Also it doesn't throw up any exception.
    I have my code used as shown below.
    Can anyone please let me know what could be the problem?
    <af:treeTable var="step" id="lpexec34" rowBandingInterval="0"
    columnStretching="blank" width="100%"
    value="#{pageFlowScope.loadPlanExecutionDetailBean.relationships.loadPlanSteps
    binding="#{pageFlowScope.loadPlanExecutionDetailBean.richTreeTable}"
    initiallyExpanded="true">
    <f:facet name="contextMenu">
    <af:popup id="lpeStepsPopup" contentDelivery="lazyUncached">
    <af:setPropertyListener
    from="#{pageFlowScope.loadPlanExecutionDetailBean.relationships.loadPlanSteps.
    rowData}"
    to="#{rowStepData}"
    type="popupFetch"/>
    <af:menu id="lpeStepsContextMenu">
    <af:commandMenuItem text="#{bundle.mark_as_complete}"
    id="cmei0b"
    actionListener="#{pageFlowScope.loadPlanExecutionDetailBean.actionPerformed}"
    rendered="#{rowStepData.markAsCompleteRendered}">
    <f:attribute name="lpiStepLog"
    value="#{step.loadPlanInstanceStepLog}"/>
    <f:attribute name="loadPlanInstance"
    value="#{step.loadPlanInstance}"/>
    </af:commandMenuItem>
    </af:menu>
    </af:popup>
    </f:facet>
    <f:facet name="nodeStamp">
    <af:column headerText="#{bundle.lp_steps_header_stepsHierarchy}"
    id="loadPlanexecDetail_hierarchy">
    <af:panelGroupLayout id="pledetail_pg10">
    <af:image source="/resources/images/loadplan/#{step.elementType}.png"
    inlineStyle="margin-right:3px; vertical-align:middle; height:16px;
    width:16px;"/>
    <af:commandLink id="lpcl0_lpe" text="#{step.name}"
    action="#{pageFlowScope.loadPlanExecutionDetailBean.relationships.stepClicked}
    ">
    <af:setPropertyListener from="#{step}"
    to="#{pageFlowScope.lpElement}" type="action"/>
    </af:commandLink>
    </af:panelGroupLayout>
    </af:column>
    </f:facet>

    Hi,
    try setting partialSubmit=true on the command link. Just in case it fires the action method before the context menu displays
    Frank

  • Link between data table sap

    hye!
    i want to know how to make a link between datatable in sap R/3.
    For exemple: i'm loocking to the table MARC in this table there is a lot of area: MAXLZ,EISBE... and for the table MARA there is the following areas: MTART,MEINS...;
    i want to find the link between that 2 tables ( my project is to extract data from sap )

    Hi!
    The common field of MARA and MARC is MATNR - you can join the two tables by this field.
    <a href="http://www.sapgenie.com/abap/tables_mm.htm">This</a> english site has some very nice overview pictures of tables connections, here e.g. for master data and purchasing.
    Regards,
    Christian

  • Composite clients:  include command button inside data table

    Directly placing the command button into the datatable does work. However, I'd like to move it outside to another file and then include it. What's the best approach, to use ui:include? Is there a better approach?
    I'd like to have datatable.xhmtl and deletebutton.xhtml
    <?xml version='1.0' encoding='UTF-8' ?>
    <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                    xmlns:h="http://java.sun.com/jsf/html"
                    xmlns:f="http://java.sun.com/jsf/core"
                    template="./beatlesTemplate.xhtml">
        <ui:define name="content">
            <h:dataTable value="#{beatles.list}"  var="beatle">
                <h:column>
                    <ui:include src="deleteButton.xhtml"/>
                </h:column>
                <h:column>
                     <h:commandButton id = "btnn" value="new row" actionListener="#{pc_Test.newRow}" />
                </h:column>
                <h:column>
                    <h:outputText value="#{beatle.title}"/>
                </h:column>
                <h:column>
                    <h:outputText value="#{beatle.comments}"/>
                </h:column>
            </h:dataTable>
        </ui:define>
    </ui:composition>
    <?xml version='1.0' encoding='UTF-8' ?>
    <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                    xmlns:h="http://java.sun.com/jsf/html"
                    xmlns:f="http://java.sun.com/jsf/core"
                    template="./beatlesTemplate.xhtml">
        <ui:define name="deleteButton">
            <h:commandButton id = "btnn" value="new row" actionListener="#{pc_Test.newRow}" />
        </ui:define>
    </ui:composition>

    RaymondDeCampo wrote:
    Your approach seems reasonable, did it work when you tried it?No, it didn't. Pardon, I don't have more information on that, but will come back to the topic later (probably on the mailing list, which I prefer.)

  • Command link in adf pivot table

    Hi,
    I Created one View Object (WrkVOR) Based on below query
    Select Desc1,Desc2 ,Date,Sum(Amount) From populate_wrk Group by Desc1,Desc2 ,Date
    Based on View Object we created pivot table
    Rows - Desc1 ,Desc2
    Column - Date
    Amount will come under each date (Like Matrix report)
    Up to It is working fine
    i added a command link on data(Amount) when i click the command link i am getting below error
    DVT-2015 Slice 1 Exceeds boundary -3
    please help....
    Thanks
    shk

    Hi,
    the real problem of the original poster seems to be <af:commandLink text="#{row.GlobalDealId}" id="cl1" action="createMDM" immediate="true" partialSubmit="true"> having immediate set to true in which case the request goes from restore view to render response. You usually use immediate=true on a command item to cancel an action (bypassing all the other JSF lifecycle steps).
    Peter551059,
    you don't give us much information about your case. So if the problem is IE9 and you verified IE9 is supported for the version of JDeveloper you use, then - in case you have a support contract - my best advise is to file a service request and have support looking at it just in case you hit a defect that should be filed as a bug
    Frank

  • Command Link inside table to external website in popup window

    Hi,
    I am trying to have a command link inside a table which is on the tables id. I know that if I have control of the destination page I can use setCurrentRowKeyValue. However I do not have control of the external website. So I cannot add it into my faces-config.xml file? I have tried putting a GoLink and a GoButton but I get the following Illegal character in fragment error, when I put my destination URL in. An example of the format the URL is:
    http://www.bbc.co.uk/radio?&music=#{row.PrimaryKey}&adf=123
    Where I am adding in #{row.PrimaryKey} which is the Id of the row. I would like to have the new page opened into a pop up window if this is possible.
    I am not sure if this can be done in the backing bean or whether my approach is the correct one?
    Many Thanks
    Steve

    something like...
    <af:goLink text="#{row.PrimaryKey}"
               destination="http://www.bbc.co.uk/radio?&amp;music=#{row.PrimaryKey}&amp;adf=123"
               targetFrame="_blank"/>Regards,
    Neeraj

  • Popup is not getting launched click on command link in table column value

    Hi
    We have a scenario where we bring the pop-up clicking on command link in the table column value. It was working fine before but from last few labels this is not working.
    Here is the code snippet that we are using,
    <af:table>
    <af:column>
    <af:commandLink>
    <af:outputText value=”product name” />
    <af:showPopupBehavior TriggerType=”click” PopupId=”::p1”/>
    <af:commandLink>
    </af:column>
    </table>
    <af:popup id=”p1”>
    <af:dialog>
    </af:dialog>
    </af:popup>
    Thanks,
    Nagesh

    It is important to set partialSubmit="true" in the <af:commandLink> tag. A full submit will be made otherwise and the popup will not show. Use also tryggerType="action" instead of triggerType="click" and use the proper chararcter case of the tag attribute names. Try with this:
    <af:commandLink text="product name" partialSubmit="true">
      <af:showPopupBehavior popupId="::p1" triggerType="action"/>
    </af:commandLink>Dimitar

  • JSP Data table - Rendering for command buttons.

    Hi All,
    We are designing a JSP page where results from table have to be thrown on a data table. (h:dataTable)
    Based on one column value on the data table, we need to render a command button for each row of data table.
    For example, I select the employees from a table and throw it on data table.
    Only for those employees where address is not present, I need to enable an "Update address" command button.
    (Command button "Update address" is also part of data table.)
    Is it possible to accomplish this on a data table?
    If so how should we code the "rendered" tag of the command button in data table.
    Any help would be greatly appreciated.
    Thanks.

    Sounds like the JSF forum would be a closer alignment, but in general
    - retrieve your information from the database into a list of Employee beans.
    - Have your h:dataTable use the list of Employee beans as a datasource
    - have the rendered attribute of your update button depend on the value of employee.address maybe #{empty employee.address}
    cheers,
    evnafets

  • Programatically adding command links in ADF Tree?

    Hi,
    I am using Build JDEVADF_11.1.1.3.PS2_GENERIC_100408.2356.5660. Can anyone please provide me some sample code for programatically adding dynamically generated ADF command links in the nodes of ADF Tree(Tree nodes in it are created using View Object - Drag & drop of data control). Now how can i add links in the nodes generated.
    Thanks,
    Vik

    Hi,
    try setting partialSubmit=true on the command link. Just in case it fires the action method before the context menu displays
    Frank

Maybe you are looking for

  • Skype number problem I need help

    I am trying to have people calling me on my Skype number but it is not working Skype people dont have a phone number or tecnical support .. some one can help me ?

  • S01 Sync

    Hi I am on SP 14 and have developed two set of Bapi Wrappers GetList, GetDetail) and two Sync Bo's. Tied into one MCD and one Mobile Application. I am using S01 sync. I am able to get the data from the backend during Syncronization. But If I change a

  • Id does not start on SE Xperia Mino pro, ALTHOUGH android 2.1 , it says (device does not meet system requirements)

    Was able to install, but at startup says: the device does not meet minimum system requirements. sony ericsson xepria x10 mini pro Model U20i android 2.1 update 1 probabaly the screen is too small? build 2.2.A.0.504

  • Reverse Proxy Configuration - Apache as an SSL reverse-proxy

    Hi, We have EP 6.0 SP 14 installed with SSL configured. We are in need to open the application to internet. For the same we have set up a reverse proxy server (Apache as SSL Reverse Proxy). Our requirement is to open the application to the internet w

  • Upgrade to FCS 3 CONFUSION!

    Just bought the FCS 3 upgrade. Will be installing on a 17" Macbook Pro. Apple Store told me I have to install my current version 1 of FCS first before I can do the upgrade. But FCS 1 is also an upgrade, so how far do I have to track backwards in this