Conditional rendering of editor components for a clickToEdit table

A very common use case related to table with 'click-to-edit' mode is to render some custom editor component for some cells, when user selects a row for edit. Newly added (as part of PS2 release) 'activeRowKey' attribute on table component will help us here.

The 'activeRowKey'is the row that is currently active on the client. In click-to-edit mode, the active row will be made editable and is brought into view (if not already visible). Upon initial display, the click-to-edit component defaults the active row to the first visible row.


A bit about the implementation. Please see the below given jsf tag snippet, which may help you to understand the concept better. Here, the EL 'backingBeanScope.TestBean.tbl.rowKey eq backingBeanScope.TestBean.tbl.activeRowKey' checks whether current row is the activeRowKey, and based on that display is flipped between components

<af:column sortProperty="DummyAttribute" sortable="true"
  headerText="#{bindings.DepartmentsView11.hints.DummyAttribute.label}"
  id="c2">
    <af:switcher id="s1" defaultFacet="InActive"
       facetName="#{TestBean.tbl.rowKey eq TestBean.tbl.activeRowKey ? 'Active':'InActive'}">
        <f:facet name="InActive">
            <af:outputText value="#{row.bindings.DummyAttribute.inputValue}"
                               id="it3"/>
        </f:facet>
        <f:facet name="Active">
            <af:commandButton text="I'm Dummy" id="cb1"
                                  partialSubmit="true"/>
        </f:facet>
    </af:switcher>
 </af:column>

You can download the sample workspace from here.
[Runs with Oracle JDeveloper 11g R1 PS2 + HR Schema]

Comments

  1. Dear Experts,

    I facing the issue for pagination ADF table control. My requirement like first page contain 10 record like that bottom of the table I should show 1 2 3 ... pagination.

    Please any suggestion??

    Regards
    Sasi.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Sasi
    ADF Faces table follows 'fetch on scrolling' to simulate the classic/conventional pagination behavior. This seems to be a better approach for most of the usages. That said, however you can try the below link which may help you to get started if you plan to build the pagination in the way you described.

    http://www.oracle.com/technology/products/jdev/tips/fnimphius/tablescrollingbyindex/index.htmlo

    ReplyDelete
  4. Hi Jobinesh,

    I have a condition where my adf table based on a VO (filtered rows for a particular location). However, there might be a case where the user creates a new row and wants to assign a location (and modify) the row in the table. But this row may not be unique and may be already present in the db. That means i create the row with parameters, and try to commit, if it already exists i update else insert. however, now i get uniqueness constraint since its creating new row. Do you know how we can create a vo row that will update if exists else create ?

    otherwise i can fetch the row independently and put it up in the iterator if it already exists. but i guess i will face the uniquenss error

    thanks
    sunil

    ReplyDelete
  5. i want to show particular row as click to editable.
    based on the condition
    https://forums.oracle.com/forums/forum.jspa?forumID=83

    ReplyDelete

Post a Comment