Formatting a dynamic datatable

Hello, I am displaying a datatable on screen with a dynamic number of columns and rows and everything is working fine. However, I would also like to apply columnClass formatting to the columns and obviously the number of classes is dependent on the number of columns. In a regular static datatable in our system, I would normally do something like:
columnClasses="tierNameStyle,tierCheckStyle,tierNameStyle,tierNameStyle" styleClass="dataTableStyle"But if I add this into my dynamic datatable JSP as this, it ignores the formatting:
<h:dataTable binding = "#{dataSetBB.dataSetTableHeadings}" var="rows" value="#{dataSetBB.tableHeadingRows}" columnClasses="tierNameStyle,tierCheckStyle,tierNameStyle,tierNameStyle" styleClass="dataTableStyle"/>Is there a way to do this in the backing bean since I am doing everything else for the dynamic table there?

OK, I tried that and it still seems to be ignoring my columnClasses. Here is my code from the backing bean where I am building the table. Am I doing something wrong?:
     public DataSetBB(){
               //setup dataModel
               String[] colHeadings = new String[]{"Heading1", "Heading2", "Heading3"};
               String[] colDetail = new String[]{"Detail1", "Detail2", "Detail3"};
               Object[] headingsArray = new Object[]{colHeadings};
               Object[] detailArray = new Object[]{colDetail};
               tableHeadingRows = new ArrayDataModel();
               tableHeadingRows.setWrappedData(headingsArray);
               tableDetailRows = new ArrayDataModel();
               tableDetailRows.setWrappedData(detailArray);
               //setupTable
               dataSetTableHeadings = new HtmlDataTable();
               dataSetTableDetails = new HtmlDataTable();
               dataSetTableHeadings.setStyleClass("dataTableStyle");
               dataSetTableHeadings.setColumnClasses("tierNameStyle,tierCheckStyle,tierNameStyle");
               dataSetTableDetails.setStyleClass("dataTableStyle");
               dataSetTableDetails.setColumnClasses("tierNameStyle,tierCheckStyle,tierNameStyle");
               UIColumn col;
               UIInput in = null;
               Application app  = FacesContext.getCurrentInstance().getApplication();
               int colCount = colHeadings.length;
               for(int j = 0; j < colCount; ++j) {
                    in = new UIInput();
                    col = new UIColumn();
                    in.setId("input" + j);
                    ValueBinding vb = app.createValueBinding("#{rows["+j+"]}");
                    in.setValueBinding("value", vb);
                    in.setRendererType("javax.faces.Text");
                    col.getChildren().add(in);
                    dataSetTableHeadings.getChildren().add(col);
               for(int j = 0; j < colCount; ++j) {
                    in = new UIInput();
                    col = new UIColumn();
                    in.setId("detail" + j);
                    ValueBinding vb = app.createValueBinding("#{rows["+j+"]}");
                    in.setValueBinding("value", vb);
                    in.setRendererType("javax.faces.Text");
                    col.getChildren().add(in);
                    dataSetTableDetails.getChildren().add(col);
     }

Similar Messages

  • How to create dynamic DataTable with dynamic header/column in JSF?

    Hello everyone,
    I am having problem of programmatically create multiple DataTables which have different number of column? In my JSF page, I should implement a navigation table and a data table. The navigation table displays the links of all tables in the database so that the data table will load the data when the user click any link in navigation table. I have gone through [BalusC's post|http://balusc.blogspot.com/2006/06/using-datatables.html#PopulateDynamicDatatable] and I found that the section "populate dynamic datatable" does show me some hints. In his code,
    // Iterate over columns.
            for (int i = 0; i < dynamicList.get(0).size(); i++) {
                // Create <h:column>.
                HtmlColumn column = new HtmlColumn();
                dynamicDataTable.getChildren().add(column);
                // Create <h:outputText value="dynamicHeaders"> for <f:facet name="header"> of column.
    HtmlOutputText header = new HtmlOutputText();
    header.setValue(dynamicHeaders[i]);
    column.setHeader(header);
    // Create <h:outputText value="#{dynamicItem[" + i + "]}"> for the body of column.
    HtmlOutputText output = new HtmlOutputText();
    output.setValueExpression("value",
    createValueExpression("#{dynamicItem[" + i + "]}", String.class));
    column.getChildren().add(output);
    public HtmlPanelGroup getDynamicDataTableGroup() {
    // This will be called once in the first RESTORE VIEW phase.
    if (dynamicDataTableGroup == null) {
    loadDynamicList(); // Preload dynamic list.
    populateDynamicDataTable(); // Populate editable datatable.
    return dynamicDataTableGroup;
    I suppose the Getter method is only called once when the JSF page is loaded for the first time. By calling this Getter, columns are dynamically added to the table. However in my particular case, the dynamic list is not known until the user choose to view a table. That means I can not call loadDynamicList() in the Getter method. Subsequently, I can not execute the for loop in method "populateDynamicDataTable()".
    So, how can I implement a real dynamic datatable with dynamic columns, or in other words, a dynamic table that can load data from different data tables (different number of columns) in the database at run-time?
    Many thanks for any help in advance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    flyeminent wrote:
    However in my particular case, the dynamic list is not known until the user choose to view a table. Then move the call from the getter to the bean's action method.

  • Generating a REAL dynamic datatable

    Hi,
    I've been looking for a solution, reading a lot of books about server faces, understood the whole Beans concept, took some sun courses (incl 314) but still don't get one thing. I need to finish a project and i have to move on fast now.
    I want to be able to :
    Generate a dynamic datatable from any query, WITHOUT having to know and create each column component for each resulting column.
    In addition i need to be able to have a commandbutton on each row, that would enable me to retrieve which row should be updated exactly.
    I found tons of examples on that, some people on forums wrote about how to do dynamic datatables, but they created each column from start and binded them to a fix field. I read a lot and tried a lot and til now i was just dissappointed of some people's code spaming google search results on "dynamic datatable" that definetly is not a dynamic datatable.
    I tried myfaces samples too from apache, decompiled their bean, but they backing it with a simple datamodel and an arraylist :-(
    1. I need someone to explain me how to generate a dynamic datatable.
    2. I need to back that datatable with a cachedRowSet or a ResultSet and to understand how to get UIData from a ResultSet.
    Sincerely please help i really need help about that fast.

    The goal i wanted to reach (and my definition of "dynamic") is not having to redesign everything as soon as something changes.
    Because binding has to be done, objects have to be declared for each column, and because binding is not dynamic (no expression), you cannot have a REAL dynamic datatable. I got that now meanwhile.
    Exactly as i thaught (still HTML cough), it's web-based and a problem of the programming language.
    Like in Delphi Pascal, or any none web-based development language, one could have done such thing in 5 minutes.
    The problem with Java JSP JSF is that you only find out its limits after you have put some time into it, but not when you get conviced to use it.
    I remember speaches swearing "it can do everything that other languages can and more ..." Well, i don't think so.
    I meanwhile found so many threads of programmers, having to migrate to Java JSP JSF and now being lost in the same situation.
    Still open to any suggestions.

  • To find the "column value"  when clicked on Dynamic datatable

    I ahve done a dynamic table where the first row alone i ahve declared as command link.So when I click on the commadn link I need to get either column name or column count or rowdata.If I Get then I have some logic based on it to do.
    I have placed my dynamic datatable code below.
    public class Datatable2 extends PageCodeBase
    UIData dataTable =new UIData();
    public Datatable2()
    UIColumn col;
    UIOutput out = null;
    ArrayList al=new ArrayList();
    al.add("Item");
    al.add("Creation date");
    al.add("Priority");
    Application app = FacesContext.getCurrentInstance().getApplication();
    int colCount = 3;
    for(int j = 0; j < colCount; ++j) {
    out = new UIOutput();
    col = new UIColumn();
    if(dataTable.getRowIndex()==-1)
    MethodBinding mb = app.createMethodBinding("#{pc_DataTable.item}", null);
    HtmlCommandLink link = (HtmlCommandLink)app.createComponent(HtmlCommandLink.COMPONENT_TYPE);                     link.setActionListener(mb);
    link.setAction(mb);
    link.setId("Command"+j);
    ValueBinding vb1 = app.createValueBinding("#{commands" + j + "}");
    link.setValueBinding("value",vb1);
    link.setRendererType("javax.faces.Link");
    HtmlOutputText O = new HtmlOutputText();
    O.setValue(al.get(j).toString());
    link.getChildren().add(O);
    col.setHeader(link);   
    ValueBinding vb = app.createValueBinding("#{rows["+j+"]}");
    out.setValueBinding("value", vb);
    out.setRendererType("javax.faces.Text");
    col.getChildren().add(out);
    dataTable.getChildren().add(col);
    public UIData getDataTable()
         return dataTable;
    public void setDataTable(UIData dataTable)
    this.dataTable=dataTable;
    public Object[] getTableRows()
    Object[] test = new Object[]{new String[]{"1","2","3"},
    new String[]{"4","5","6"},
    new String[]{"7","8","9"},
    new String[]{"10","11","12"},
    new String[]{"13","14","15"}};
    return test;
    this is my jsp code
    <f:view>
    <P>Place content here.</P>
    <h:form>
    <h:dataTable binding="#{pc_Datatable2.dataTable}" value="#{pc_Datatable2.tableRows}" var= "rows" />
    </h:form>
    </f:view>
    Could please tell how can i figure out my coulmn value when clicked on the command link

    hello,
    u can use two types methods  u can create a dynamic action or by branching using conditional or java script code
    for java script code just call the code when button clicked and in javascript function by using if condition u can redirect.
    Regards,
    Ramana

  • Dynamic datatable:adding rows

    I am working with Dynamic datatable . whilke adding a row i am able to add only one row . later i am unable to a dd .
    code:
    <h:commandLink value="ADD" action="#{icdMBean.actionAddrow}" />
    back bean:
    public void actionAddrow() {
    // Create new items.
    icdList= new ArrayList<Icd>();
    Icd myNewDataItem = new Icd();System.out.println("i am in action add row2");
    myNewDataItem.setId("new");
    icdList.add(myNewDataItem);
    if i set the id value( myNewDataItem.setId("new");) only i am able to add only one row .
    could you please suggest a solution for it.

    Hi, many thanks for your answer, so what do you think is the best solution for adding rows by user to interactive form's dynamic table?
    Manually read xml data during submit by this way: https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/9121. [original link is broken] [original link is broken] [original link is broken] ?
    Or is there better solution for this? (any link to some examples, blogs, etc...)
    Many thanks for any answer!

  • How to create a Dynamic Datatable with sorting functioanlity

    Hi,
    I am new to JSF and need some help can some one please tell me how to create a dynamic datatable with sorting functionality. I am reading data data from a database table and wants to build the datatable dynamically based on the columns returned. I know how to created a datatble with a fixed number of columns but can't figure out how to create a datatable dynamically with sort functionality. Any small example will help.
    Thanks

    Hi,
    Here is what I have so far and can't figure out how to add the sorting functionality. Any help is appreciated.
    Managed Bean:
    private List<MyDto> data ;
        public HtmlDataTable getDataTableOne ()
            if ( dataTableOne == null )
                populateCheckBoxes () ; // Preload.
                populateDynamicDataTableOne () ;
            return dataTableOne ;
        public void populateCheckBoxes ()
            data = new ArrayList<MyDto> () ;
            MyDto myDto1 = new MyDto () ;
            MyDto myDto2 = new MyDto () ;
            MyDto myDto3 = new MyDto () ;
            MyDto myDto4 = new MyDto () ;
            myDto1.setChecked ( true ) ;
            myDto1.setValue ( "myDto1" ) ;
            myDto2.setChecked ( false ) ;
            myDto2.setValue ( "myDto2" ) ;
            myDto3.setChecked ( false ) ;
            myDto3.setValue ( "myDto3" ) ;
            myDto4.setChecked ( true ) ;
            myDto4.setValue ( "myDto4" ) ;
            data.add ( myDto1 ) ;
            data.add ( myDto2 ) ;
            data.add ( myDto3 ) ;
            data.add ( myDto4 ) ;
        public void populateDynamicDataTableOne ()
            dataTableOne = new HtmlDataTable () ;
            UIOutput header = new UIOutput () ;
            header.setValue ( "" ) ;
            UIColumn tableColumn ;
            tableColumn = new UIColumn () ;
            HtmlOutputText textHeader = new HtmlOutputText () ;
            textHeader.setValue ( "" ) ;
            tableColumn.setHeader ( textHeader ) ;
            HtmlSelectBooleanCheckbox tCheckBox = new HtmlSelectBooleanCheckbox () ;
            tCheckBox.setValueBinding ( "value" , FacesContext.getCurrentInstance ().getApplication ().createValueBinding ( "#{row.checked}" ) ) ;
            tableColumn.getChildren ().add ( tCheckBox ) ;
            // Set output.
            UIOutput output = new UIOutput () ;
            ValueBinding myItem = FacesContext.getCurrentInstance ().getApplication ().createValueBinding ( "#{row.value}" ) ;
            output.setValueBinding ( "value" , myItem ) ;
            // Set header (optional).
            UIOutput header2 = new UIOutput () ;
            header2.setValue ( "" ) ;
            UIColumn column = new UIColumn () ;
            column.setHeader ( header2 ) ;
            column.getChildren ().add ( output ) ;
            dataTableOne.getChildren ().add ( tableColumn ) ;
            dataTableOne.getChildren ().add ( column ) ;
    MyDto.java
    public class MyDto
        private Boolean checked;
        private String value;
        public MyDto ()
        public void setChecked ( Boolean checked )
            this.checked = checked;
        public Boolean getChecked ()
            return checked ;
        public void setValue ( String value )
            this.value = value;
        public String getValue ()
            return value ;
    JSP
    <h:dataTable id="table" value="#{myRequestBean.data}" binding="#{myRequestBean.dataTableOne}" var="row" />Thanks

  • Creating dynamic dataTables **Very Urgent**

    Hi all,
    I m very new to JSF Technology. I m in need of creating dynamic dataTables. I need to populate the values from DB. At times, the number of columns varies. So, how can i create such kind of table? At least i need to know how can i create dataTable values using the Backing bean and mapping it to the JSF page, so that the browser will render that dataTable?
    Please help me.. :)

    The following code (taken from the BalusC article) do the task:
                // Create <h:column>.
                HtmlColumn column = new HtmlColumn();
                dynamicDataTable.getChildren().add(column);
                // Create <h:outputText value="dynamicHeaders"> for <f:facet name="header"> of column.
    HtmlOutputText header = new HtmlOutputText();
    header.setValue(dynamicHeaders[i]);
    column.setHeader(header);
    // Create <h:outputText value="#{dynamicItem[" + i + "]}"> for the body of column.
    HtmlOutputText output = new HtmlOutputText();
    output.setValueExpression("value",
    createValueExpression("#{dynamicItem[" + i + "]}", String.class));
    column.getChildren().add(output);

  • Dynamic DataTable without validation of the rest of the form

    I'm having a bit of trouble implementing a piece of functionality with JSF and I'm hoping someone here will have some insight into how to accomplish this.
    I have a quite large form, with some fields requiring quite complex and expensive (both performance and actual money) validation (e.g. calling external web services, etc.). For the sake of the explanation, let's say the user enters details about himself, such as name, social security number, address, etc. Along with his details, he's to enter a limited subset of the details for each of his children (say name and social security number). We do not know at design time how many children the user has (obviously), so this part of the form has to be dynamically generated. Validation is performed on these children fields as well, so the user needs to be able to edit and remove children from the form.
    Prior to JSF (straight JSP), I used DHTML and a naming scheme for these records with a custom setters in the backing beans.
    What I have tried with JSF is to have a DataTable backed by a List. This table contains a single "Add Child" button which adds a new empty row to the table. There is also a "Remove" button for each row.
    This works just great as long as I allow all other fields in the form to validate each time the user clicks the button. However, as I stated before, these validations are very very expensive (transaction based costs) . Additionally, I do not want to force the user to fill in all the other required fields (close to 40) before he can go on with the children.
    Now, setting immediate="true" on the commandButton elements solves the problem of the other form fields validating. However, now the Children in the DataTable are never set because the update model values phase is never invoked, leaving me with empty input fields. I really do not care in this instance whether the data for the Children is valid or not, I just need to get them into the form.
    I can think of at least three possible solutions:
    1) Split up the form into several pages, like a wizard. However, the customer has rejected this option.
    2) Somehow simplify the Children section by providing a single entry and a read-only table. This way I can use a simpler read-only table and I can extract the values from the request parameters directly. However, this complicated the editing of previously entered Children. To make things worse, the order of the children has to remain intact.
    3) Create a custom HtmlInputText component that sets the values regardless of whether immediate="true" or "false".
    It is this last option that I do not know how to do. Which methods would I need to override in order to get the values to be set in my bounded Children object regardless of the immediate flag?
    And of course, if anybody has any other design suggestions I'm open to them!
    Thanks in advance!
    /Kris

    nboudani , let me answer your question first. The page does have a Submit button. It also has "Add Child" and "Remove Child", and some others as well. The Submit button has immediate="false". I also need form validation for interdependent form fileds (e.g. either Passport number or social security number are required), so I'm using the "hidden input field at the bottom of the form trick". This all works well enough.
    OK, I got partway there. jaguar2010's mention of valueChangeListener made me investigate that further. So what I did was twofold. Set the immediate attribute to true for the inputText elements in question (for the Children data) as well as for the commandButton (as before). Also, add a valueChangeListener for each of the Children which simply calls updateModel.
    So, view code:
    <h:inputText id="cName"
                           valueChangeListener="#{testBean.procCNameValueChanged}"
                           value="#{child.name}"
                           required="true"
                           immediate="true"/>
    <h:inputText id="cSS"
                           valueChangeListener="#{testBean.processCSSValueChanged}"
                           value="#{child.ss}"
                           validator="#{testBean.validateCSS}"
                           immediate="true"/>
    <h:commandButton action="#{testBean.addChild}" immediate="true" value="Add Child"/>
    ...bean code:
    public void procCNameValueChanged(ValueChangeEvent event) {
        HtmlInputText sender = (HtmlInputText) event.getComponent();
        sender.updateModel(FacesContext.getCurrentInstance());
    }So, that does take care of the problem with the model not updating. However, there are a bunch of other problems still left to be resolved. For instance, as you'll notice, there is a validator attached to one of the inputs. If this validation fails, the invalid text is not put back in the input field. I can't temember now, but I think that is because the valueChangeListener is not called in that case, so the model is not updated. Sigh...
    Another problem is that for each row in the data model's table, there is a "Remove" button (not shown in above code) to enable the user to remove an entry from the list of children. Well, because JSF process events in the order of their appearance in the view code, an exeption is thrown if the removed row is not the last one, and the last row has not been "saved" yet. That is, the valueChangeListener has not been called on the last row. What happens is that first the action method for the remove button is called, then the valueChangeListener for the last row is called. But by the time the valueChangeListener event is fired, the last row has chaned its index (because the remove action method was called first) and apparently this fact has escaped JSF so it throws an exception (property not found or something).
    I'm starting to wonder if JSF is the wrong technology for complex forms. Just seems to want to do too much for me, assuming I have a simple form.

  • Strange timestamp-format in Dynamic Configuration

    Hi all,
    In the Dynamic Configuration Section I can retrieve the name and timestamp of the inputfile I use. But the timestamp is in a format I don't quite understand.
    For instance, the last changedate of the inputfile is 24-06-2008, 10:58. In the Dynamic Configuration section I find the timestamp "20080624T035800Z". There seems to be a difference of 5 hours here, and I have no idea what the "Z" on the last position means.
    How can I convert this timestamp from the Dyn.Conf. to the actual timestamp?
    Thanks,
    William

    You can use subString to get the desired output.
    There is no such Java Function available for you.
    even TimeStamp differs your output
    function myudf(String a, Container container)
    //input is yyyymmddThhmmssZ
    String year=a.subString(0,4);
    String mon=a.subString(4,2);
    String date=a.subString(6,2);
    String hour=a.subString(9,2);
    String min=a.subString(11,2);
    String sec=a.subString(13,2);
    // output is dd-mm-yyyy hh:mm:ss
    String ret=date"-"mon"-"year" "hour":"min":"+sec;
    return ret;

  • Dynamic datatable in custom component

    hi all,
    i'm working on a custom jsf component and this component will create a datatable dynamically. (you can see component details from http://www.jroller.com/page/hasant?entry=creating_dynamic_datatable_inside_of AND http://www.jroller.com/page/hasant?entry=jsf_question_for_community_what)
    the question is; when i want to add a selection column(dynamically), how can i handle its selected values?
    i mean, if i have created this datatable in a page with designer, i would bind an Integer[] to that selection column's checkboxes. But i have to add this selection column dynamically from my component. So, how can i GET and SET the selection columns values. Since this is a custom component, there is no backing bean for value binding to this component.
    when i resolve the request param string to get the selected rows, it's working(=i can see the selected rows somehow..) but, i can not set that values again while encoding that column after a submit.
    here is my row selection column encoding code;
         private void addSelectionColumnToTable(FacesContext context, UIData table) {
              UIColumn column = new UIColumn();
              HtmlInputRowSelect rowSelect = new HtmlInputRowSelect();
              rowSelect.setId("rowSelect1");
              rowSelect.setStyleClass("inputRowSelect");
              rowSelect.setValue(m_selectedRows);
              column.getChildren().add(rowSelect);
              table.getChildren().add(column);
         }In the code above, rowSelect.setValue(m_selectedRows); part not effecting anyhing. m_selectedRows variable includes row numbers(in an Integer array) that i want to see as selected.
    any solution/recommendation?

    Well if you are still interested in using a text component
    instead of a Button the way you would go about this is using
    textWidth. Here's how I've done it before using a text / label
    whatever you want that shows text.
    // => Set our text we got from database
    myText.text = "This is the text I got from the DB";
    // => Validate it so that way we make sure we get right
    numbers
    myText.validateNow();
    // => Find out how wide our text really is.
    var textWidth:Number = myText.textWidth
    // => Reset the width of our text component and add 20 for
    a little buffer
    myText.width = textWidth + 20;
    Now my suggestion is if your going to be dynamically creating
    these on the fly from a database call you throw it into a method /
    class and have that do all the work for you so all you have to do
    is pass the text to it and it resizes itself based on the example
    above.

  • Dynamic DataTable Creation

    Hi
    I want to write dataTable dynamic. with command link column..for that I had written following code.
    import javax.faces.application.Application;
    import javax.faces.component.UIInput;
    import javax.faces.component.UIMessage;
    import javax.faces.component.UIOutput;
    import javax.faces.component.UIColumn;
    import javax.faces.component.UIData;
    import javax.faces.component.UIPanel;
    import javax.faces.context.FacesContext;
    import javax.faces.el.ValueBinding;
    import javax.faces.component.html.HtmlDataTable;
    import java.util.ArrayList;
    import javax.faces.component.html.HtmlOutputLink;
    protected void populateDataTable() { //
    FacesContext facesContext = FacesContext.getCurrentInstance();
    Application application = facesContext.getApplication();
    UIData panel = (UIData) application.createComponent("javax.faces.component.html.HtmlDataTable");
    String valueBindingExpressionForPanel1 = "#{" + "ListHolderBean.employeeList" + "}";
    String valueBindingExpressionForPanel2 = "employee";
    ValueBinding valueBindingForPanel1 = application.createValueBinding(valueBindingExpressionForPanel1);     
    ValueBinding valueBindingForPanel2 = application.createValueBinding(valueBindingExpressionForPanel2);
    panel.setValueBinding("value", valueBindingForPanel1);
    panel.setValueBinding("var", valueBindingForPanel2);
    for (int index = 0; index < 2; index++) {
         UIColumn column = (UIColumn) application.createComponent("javax.faces.component.UIColumn");
         //output link     
    UIOutput outputLink = (UIOutput) application.createComponent("javax.faces.component.html.HtmlOutputLink");
    // message.getAttributes().put("for", fieldNames[index]);
    String valueBindingExpression = "#{" + "employee.name" + "}";
    ValueBinding valueBinding = application.createValueBinding(valueBindingExpression);     
    System.out.println(valueBindingExpression);
    outputLink.setValueBinding("title", valueBinding);
    outputLink.setValueBinding("value", valueBinding);
    ValueBinding valueBinding2 = application.createValueBinding("update(this.title);");
    outputLink.setValueBinding("onmousedown", valueBinding2);
    ValueBinding valueBinding3 = application.createValueBinding("onclick");
    outputLink.setValueBinding("onclick", valueBinding3);
    column.getChildren().add(outputLink);
    panel.getChildren().add(column);
    Following error comes when I run this code
    Named Object: 'javax.faces.component.html.HtmlDataTable' not found.
    What is issue although I had import that file also .

    Application#createComponent() requires ComponentType. For an HtmlDataTable it is "javax.faces.HtmlDataTable". Also see HtmlDataTable.COMPONENT_TYPE.
    So you have to use createComponent(HtmlDataTable.COMPONENT_TYPE);.
    Or just HtmlDataTable table = new HtmlDataTable();
    By the way an OutputLink is not the same as CommandLink.

  • Formatting date in datatable

    Hi all,
    is there any alternative to the following code to format a date?
    <fmt:formatDate pattern="yyyy-mm-dd" value="#{project.statusDate}"/>
    The date is retrieved in a datatable and I can therefore not use ${} syntax. Finally I need to find a solution to format that date as the above will obviously not work.
    Does anyone have an idea?
    Thanks

    Ah well I found the solution myself
    Here you go:
              <h:outputText value="#{project.statusDate}">
                <f:convertDateTime pattern="yyyy-MM-dd" />
              </h:outputText>

  • Changing formats of dynamic prompt parameters

    Hello,
    I am currently using Business Objects XI R2 (SP3) and some users have a dynamic prompt that returns what year the report should query on. However, the prompt is currently returning this:
    2,006
    2,007
    2,008
    2,009
    2,010
    Is there a way (besides converting the number to text) to get rid of the thousand separator? Also, what about dates? How can you change the format they are displayed as?

    Bad news on both fronts...
    #1 The only way to format that correctly would be to bring those values in as text. To make matters even more complicated, they have to come from the DB as text... You can't use a CR formula to to convert the value and then use the formula.
    #2 You're stuck with YYYY-MM-DD for date formats... That is if you want to keep the prompt type set to Date or Date Time (and therefore, keep the date picker control.
    You do have the option to use a text style prompt and allow the user to enter dates however they like...
    Sorry I don't have better answers...
    Jason

  • Dynamic datatable and command link

    I'm having a problem creating CommandLink's automatically. What we have is a tag, which can contain a set of data. We need this on several locations, so we have to create a datatable dynamically. When you press a link, it should be possible to retrieve the ID of the component on that specific row.
    The problem is, we can create the table with the necessary data. When I construct the column with the ID (and the link), it fails.
    Code:
    HtmlCommandLink link = new HtmlCommandLink();
    Application app = FacesContext.getCurrentInstance().getApplication();
    ELContext elContext = FacesContext.getCurrentInstance().getELContext();
    ValueExpression ve = app.getExpressionFactory().createValueExpression(elContext,"${" + TABLE_VAR_NAME + "." + property + "}", Object.class);
    link.setValueExpression("value", ve);
    link.getAttributes().put("rowId", ve.getExpressionString() );
    link.addActionListener(
        new ActionListener(){
         public void processAction(ActionEvent arg0)
              throws AbortProcessingException {
              LOG.info(">>>>>>>>>>>>> Linked pushed !!"  +
              arg0.getComponent().getAttributes().get("rowId"));
    selectColumn.getChildren().add(link);
    datatable.getChildren().add(selectColumn);The rowId is always #{row.code}, instead of the actual data. Is there a way to create a command link dynamically, press it and retrieve the ID of that field? That expression should be evaluated at runtime and added to the datatable, but that doesn't happen apparently.

    I've read your article, but I didn't find anything I could use. Facing a deadline and don't really have time to try out multiple (possible) solutions. The problem is that all the examples I can find point to MethodBinding, but I don't need that. I just need to get the ID of the row that was clicked, nothing more.
    This works fine:
    link.setValueExpression("value", ve);I don't see why the other expression isn't evaluated.
    I can do getParent().getParent() to get a reference to the DataTable, but the datamodel on that object is empty btw.

  • Misinterpreting JPEG file format when dynamically select mages

    Hi everybody,
    I notice one strange thing, how OBIEE 11g interprets JPEG file name formats. I've activated analyticsRes service and everything worked fine....until I've tried to select dynamically the image with the JPEG file name as *6590.jpg*. I set the new photo column on the BMM layer with the expression
    *'/analyticsRes/shoes/' || CAST("ADDON_1"."DM_PLU"."MODEL_CODE" as varchar(30)) || '.jpg'*
    As you see, the name of the JPEG file was set as varchar (30), BUT! Instead of retrieving the image from the file *6590.jpg* for the particular MODEL_CODE the system shows square shape with the red cross on the left upper corner. I've tried several work arounds, but until I changed the MODEL_CODE in the DWH to *06590* and made subsequent name change for the JPEG file in the '/analyticsRes/shoes/' directory nothing worked properly.
    So, be aware, that the item name in the of the column which you refer to as a JPEG file name has varchar format (you could use '-', letters, etc.) in order to avoid system's misinterpreting of the JPEG file name.
    I would appreciate your comments.
    Regards
    AL

    Make sure that the string is showing as /analyticsRes/shoes/6590.jpg
    and then Column properties->Data Format->Image URL
    Let me know how it works

Maybe you are looking for

  • Show/Hide tabs in top level navigation of a role based on assigned services

    Hi, I have an interesting requirement. I have created an overview page in abap web dynpro which has links to various services. Based on the r3 roles assigned to the user, we need to show/hide the services in the overview page and top level navigation

  • 300 requests per hour reading from Application scope Good/Bad idea

    I am saving some html in application scope & reading with <cflock readonly. Will it be a problem if more than 5 requests are made per second? Does deadlocks occurs with readonly-cflock? Thanks

  • Deactivate default PO price from Info Record

    Dear all, Would someone enlighten me how to deactivate PO price from Info Record. PO condition is setup as not control at plant level. Regards, Peck Har

  • Port Forwarding not working after 7.7.1 Firmware update

    I bought the new 6th generation Airport Extreme today, and after I set it up, everything worked great.  I have a VoIP phone that needs to have traffic on port 5060 forwarded to it, and that worked just fine as well.  However, I then updated to the 7.

  • Imported Photos Missing

    i have an older version of iphoto (7.1.5).  I have never had a problem with importing photos til today.  I ried importing a new batch of photos from my iphoe, and when the proess was complete, the photos (and events) were nowhere to be found.  I then