Set row select

Hello.
How I can set row select from PLSQL process handler after commit.In more detail  I have some set of field in my filter. I need to select all report rows which match this filter.
Thanks in advance Andrii.

Hi Andrii,
I'm not sure if I understand you correct, but if your report has checkboxes, which you want to set checked when they match your filter, you could try the following:
In your report query, where you define your apex_item.checkbox add a case stement.
SELECT case when <your_filter_condition> then APEX_ITEM.CHECKBOX(1,<your_column>,'CHECKED')
                      else   APEX_ITEM.CHECKBOX(1,<your_column>)
              end case as " "
, <other_columns>
FROM <your_table>
regards,
Vincent Deelene

Similar Messages

  • How to set the Selected row and Column in JTable

    Hi,
    i have a problem like the JTable having one Method getSelectedRow() and getSelectedColumn to know the Selected row and Column but if i want to explicitly set the Selected Row and Column,then there is no such type of Methods.If anybody has any solution then i will be thankful to him/her.
    Praveen K Saxena

    Is that what you're looking for? :myTable.getSelectionModel().setSelectionInterval(row, row);
    myTable.getColumnModel().getSelectionModel().setSelectionInterval(column, column);

  • What happens when the row selection of a table is set as 'none'?

    I have a page, with a Search box, Departments and Employees tables. The user will enter a departmentId and click on Search button. Departments will be displayed. The departmentId column in Departments table is surrounded with a link. So when the user will click on the link, the desired employees will be displayed in the Employees table, if there is a view link between the VOs.
    Now suppose I have removed the view link. And the row selection of the Departments table is set as 'none'. So is it possible to get the desired employees of the chosen departmentId in this scenario, as because row selection has been disabled in the Departments table?
    I also dont want to use the Set Property Listener in this use case.

    Hi,
    If you have disabled rowselection and also are not implementing the selection listener? How will you find which row did the user select?
    Ramandeep

  • EL expression to set row at particular index as selected row

    Hi,
    What should be the EL expression to set row at index 'i' as selected row in a tree binding.
    I tried *#{bindings.treeBinding.collectionModel.selectedRow[i]}* . But it doesn't work.
    I also want to make the selected row as current. Will *#{bindings.treeBinding.collectionModel.makeCurrent}* work?
    Thanks
    KK

    Hi,
    create a managed bean that returns the selected RowKeys for the tree. See this example:
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/61search-in-rendered-trees-177577.pdf
    It searches for a specific label in a tree and marks it as selected
    Frank

  • How to set only one row selection  in ALV GRID DISPLAY

    How to set single row selection in grid display
    not multiselection.

    Hi,
    In the USER COMMAND, build the code to check the REFRESHED Data & then check the number of records with SEL  = 'X'.
    If more than single entry found, then raise an error message.
    Best regards,
    Prashant

  • How to dynamically display the data from a table base on row selection of another table in ADF

    Hi ,
    I have a requirement in ADF. I need to change the data of a table  based on row selection of another Table . Both the table have a Parent Child relationship between them. They have a common attribute say department_id.
                                                                                         For this I created bind variable in view object of employees table and wrote a where clause in the sql query using that bind variable. Then I created method for selection listener of department Table in java bean.
    My method is following
        public void onrowselection(SelectionEvent selectionEvent) {
            RichTable richTable = (RichTable)selectionEvent.getSource();
                            CollectionModel tableModel = (CollectionModel)richTable.getValue();
                            JUCtrlHierBinding adfTableBinding = (JUCtrlHierBinding)tableModel.getWrappedData();
                            Object selectedRowData = richTable.getSelectedRowData();
                            JUCtrlHierNodeBinding nodeBinding = (JUCtrlHierNodeBinding)selectedRowData;
                    oracle.jbo.domain.Number newVal = (oracle.jbo.domain.Number) nodeBinding.getAttribute("DepartmentId");
                    Number pallet = newVal.bigDecimalValue();
                    System.out.println("Selected values " + pallet);
            BindingContext bindingctx = BindingContext.getCurrent();
                          BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
                          DCBindingContainer bindingsImpl = (DCBindingContainer) bindings;
                  DCIteratorBinding dciter = bindingsImpl.findIteratorBinding("EmployeesView1Iterator");//access the iterator by its ID value in the PageDef file
                          ViewObject vo =dciter.getViewObject();
                          vo.setNamedWhereClauseParam("DepartmentId", pallet);//enter your value
                          vo.executeQuery();
    It is printing the selected value of department id from department table in the log. But it is not able to pass the value to employees view. It is showing the following error in the log
    "Definition DepartmentId of type Variable is not found in EmployeesView1."
    I will be very thankful if someone helps me to solve this errror or is there any other way to achieve the same requirement.
    Thanks
    Nilesh

    Note quite sure why you simply wont create a viewlink for the viewobject the tables are based on..
    The viewlink attribute will be based on the departmentId and it's a simple master detail relationship which automatically uses ppr.
    However, if both tables are on the same page; using your hack about;
    On the underlying viewobject, define a viewcriteria e.g. "listById" and set your bind variable here.
    I would bind table two to a RichTable component:
    RichTable t2;
    public void onrowselection(SelectionEvent selectionEvent) {
            RichTable richTable = (RichTable)selectionEvent.getSource();
                            CollectionModel tableModel = (CollectionModel)richTable.getValue();
                            JUCtrlHierBinding adfTableBinding = (JUCtrlHierBinding)tableModel.getWrappedData();
                            Object selectedRowData = richTable.getSelectedRowData();
                            JUCtrlHierNodeBinding nodeBinding = (JUCtrlHierNodeBinding)selectedRowData;
                    oracle.jbo.domain.Number newVal = (oracle.jbo.domain.Number) nodeBinding.getAttribute("DepartmentId");
                    Number pallet = newVal.bigDecimalValue();
                    System.out.println("Selected values " + pallet);
                   refreshTable2(pallet);
            BindingContext bindingctx = BindingContext.getCurrent();
                          BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
                          DCBindingContainer bindingsImpl = (DCBindingContainer) bindings;
                  DCIteratorBinding dciter = bindingsImpl.findIteratorBinding("EmployeesView1Iterator");//access the iterator by its ID value in the PageDef file
                          ViewObject vo =dciter.getViewObject();
                          vo.setNamedWhereClauseParam("DepartmentId", pallet);//enter your value
                          vo.executeQuery();
    private void refreshTable2(Number pallet){
    RichTable x=getT2();
    CollectionModel cm=(CollectionModel)x.getValue();
    JUCtrlHierBinding jcb=(JUCtrlHierBinding)cm.getWrappedData();
    BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
    DCBindingContainer bindingsImpl = (DCBindingContainer) bindings;
    DCIteratorBinding dciter = bindingsImpl.findIteratorBinding(jcb.getName()+"Iterator");
    ViewObject vo =dciter.getViewObject();
    ViewCriteriaManager vcm=vo.getViewCriteriaManager();
    ViewCriteria vc=vcm.getViewCriteria("listById");
    vo.applyViewCriteria(vc);
    vo.setNamedWhereClauseParam("DepartmentId",pallet);
    vo.executeQuery();
    AdfFacesContext.getCurrentInstance().addPartialTarget(getT2());

  • Unable to set the selected value for a ADF LOV

    Hi,
    I am developing an application using jdeveloper 10.1.3 and Struts.
    I have created a ADF LOV on my JSP Page as given below:
    <html:select property="lob" onchange="javascript:selectLOB(this.form)">
    <html:optionsCollection label="prompt" value="index" property="lob.displayData"/>
    </html:select>
    When i submit the form, i am able to get the value of the selected Value in the List.
    JUCtrlListBinding listBinding = (JUCtrlListBinding) formBean.get("Lob");
    Row r = (Row) listBinding.getSelectedValue();
    String SoLob = (String) r.getAttribute("LobLob");
    But i am unable to set the selected value back in the list when i return to the form again.
    I tried the following:
    int x = listBinding.getSelectedIndex();
    listBinding.setSelectedIndex(x);
    It would be really helpful if some one could let me know what needs to be done.
    Thanks,
    Subashini

    Gyan,
    I tried with the code you suggest , its trying to set the value of a field, but my requirement is to change the property for
    "Rendered" on the field so that based on search parameters we can hide result table column.
    After searching online, I modified the controller code as follows
    1.Created a new transient attribute (Testrender) with type "Boolean" and always updateable.
    2.changed the "Rendered" property value on the field I want to hide as ${oa.PoSearchVO1.Testrender}.
    3. Modified the controller code as follows :
            OAApplicationModule am = pageContext.getApplicationModule(webBean);
            OAViewObject testvo = (OAViewObject)am.findViewObject("PoSearchVO1");
            OADBTransaction txn = am.getOADBTransaction();
            if (testvo != null)
              OARow row = (OARow)testvo.first();
                if (a.equalsIgnoreCase("Approved"))
                     row.setAttribute("Testrender", Boolean.FALSE);
                else
                     row.setAttribute("Testrender", Boolean.TRUE);
            } But now when i run the page and populate the search field and click "Go" its hiding the field but throwing the following error and the search results are also bad.
    Its using only the value of one search parameter but not the second one .
    The search cannot be executed because the table has pending changes that would be lost. I think the vo is getting dirty when I update the transient attribute value. So I used txn.rollback ,then search is working fine but its not hiding the field.
    So can you please let me know how to proceed from here ?

  • How i can set the selected item of a dropDown component from java code

    Hi
    Thank you for reading my post
    How i can set the slected item of a DropDown component from backing beans java code ?
    it is binded with a database , so one field determine its display and one other field determine its value , I want to set the selected item of this combobox
    In back code i have both value and display values to use them .
    can some one give me some help ?
    Thanks ,

    See code sample 3 at http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/helloweb.html
    See also, the selection components row in the table under http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/helloweb.html
    It says
    One way to preselect items is to call setSelectedValue(Object[]) or setSelectedValue(Object) from the prerender() method. You pass in the return values of the items that you want preselected. Be sure to verify that getSelected() returns null before setting the default options, or you will overwrite the user's selections on a post-back.

  • How to avoid table refresh on row selection

    Hi,
    I have a table where the row selection happens on selecting the check box in the first column of the row. The check box is bound to the transient Boolean attribute of my VO to support this functionality which is missing in new version of ADF. The selection is working fine, however I am facing the issue with table refresh. Everytime I click checkbox to select or unselect a row my whole table is getting refreshed which is very unusual for user point of view. This is my code for the checkbox column:
    <af:column sortProperty="isSelected" sortable="true"
    headerText="#{bindings.pricingObjects.hints.isSelected.label}"
    id="c4"
    inlineStyle='#{(row.isSelected)?"background-color: #E7E7E7":""};'>
    <af:selectBooleanCheckbox value="#{row.bindings.isSelected.inputValue}"
    required="#{bindings.pricingObjects.hints.isSelected.mandatory}"
    shortDesc="#{bindings.pricingObjects.hints.isSelected.tooltip}"
    id="it4" simple="true"
    autoSubmit="true">
    <f:validator binding="#{row.bindings.isSelected.validator}"/>
    </af:selectBooleanCheckbox>
    I have to keep autoSubmit="true" on selectBooleanCheckbox because the table has to change color of the row everytime the checkbox is selected or deselected. Also, there are multiple commandToolbarButton such as "Delete" which needs to be enabled/disabled depending on the row selection.
    Is there anyway, I can achieve this behaviour with minimal refresh of table?

    Hi Marge,
    Yes I do have Add and Delete toolbar button in the panelCollection and also set partialTrigger="tableId" on them. I need this partialTriggers because Delete button should enable/disable depending on number of rows added in the table. However, I tried removing them but it did not work for me, table is still refreshing. BUT this solution does work in combination of other solution i.e. removing ChangeEventPolicy="ppr" on the iterator. I need ppr because I have a form which is bound to the same iterator and should change on table selection. The design is like this,
    - Read-only Table on top
    - Editable Form below
    - Select the row in table and edit the fields in the form
    If I remove ppr then my form is not updating with the row selection.
    Regards,
    Afroz

  • Help needed in row selection in Tabular form across pages

    Hi,
    I have a tabular form report similar to http://htmldb.oracle.com/pls/otn/f?p=31517:95. I want to select some rows from first page and then use the pagination to get to the next page, select some more rows and hit the submit button for processing. The rows selected in the last page alone are picked up for processing, and the ones selected in the earlier pages are lost. I see the same behaviour in Denes' example as well. I picked a row in the first page and a row in the next page, and then click "Pick Records", i see only the record i picked on the second page.
    I did play around with "partial page refresh" setting for the tabular form region, but that does not help.
    Is there a way to select across pages in a tabular form?
    thanks,
    Rams
    Edited by: rams1234 on Jan 22, 2009 10:19 AM

    Okay. I could make this work, but this seems to be a roundabout way for me. In my case I dont have any database related query to get the values, hence the Application level process may not be needed.
    When I select the checkbox, i get the value. I am hoping that I should be able to send the value to a javascript function and update the filed value in the function itself. Please see the function below..
    function setFileID(pThis) {
    var chkvals=pThis.value;
    var fldValue = new $x('f_FILELIST').value ;
    if (fldValue != 0)
    { $x('f_FILELIST').value= fldValue+'-'+chkvals;}
    else
    { $x('f_FILELIST').value = chkvals ;}
    This function works fine in making up the list. The issue is, when an already selected row is unselected, the value of the checkbox gets added one more time :) If I detect the checkbox status and subtract the corresponding value, this will be perfect..
    Thanks for the link anyway. I am marking this question answered.
    regards,
    Rams.
    Edited by: rams1234 on Jan 22, 2009 1:18 PM

  • Af:fileDownloadActionListener picks wrong filename for the first time after row selection.

    Hi,
    I am using Oracle Jdeveloper 11g release 1. In one of my jspx pages i have a table, i can select one of the row and click on a button which invokes fileDownloadActionListener. The code of jspx is as below:
    <af:commandMenuItem text="#{coregccomplianceuiBundle.MENU_EXPORT}"
                                        id="CS19" partialSubmit="true"
                                        actionListener="#{viewScope.core_gccompliance_cs_librarybean.validateExport}"
                                        partialTriggers="CSftLib"
                                        disabled="#{viewScope.core_gccompliance_cs_librarybean.exportDisabled}">
    </af:commandMenuItem>
    <!--This button is set hidden, which is used to deal with the download job.
        The Export button on the page only does the validation. (whether it's a system defined standard)-->
      <af:commandButton text="#{coregccomplianceuiBundle.BTNEXPORTHIDDEN}" id="csl_csExportHidden"
                                          clientComponent="true" visible="false"
                                          partialSubmit="false">
    <af:fileDownloadActionListener contentType="application/x-download" 
                                          method="#{viewScope.core_gccompliance_cs_librarybean.handleExport}"
                                          filename="#{viewScope.core_gccompliance_cs_librarybean.fileName}"/> 
    </af:commandButton>
      /** force the ExportHidden Button to do export */
        function csExportHandler(event) {
            var exportCmd = AdfPage.PAGE.findComponent("emT:CS4:csl_csExportHidden");
            var actionEvent = new AdfActionEvent(exportCmd);
            actionEvent.forceFullSubmit();
            actionEvent.noResponseExpected();
            actionEvent.queue();
    The bean methods used in above block are as below:
    public void validateExport(ActionEvent actionEvent) {
           // checks if entity is system defined and shows error popup if it is .
            if (checkIsSystem())
                return;
            //Handle the export    
            AdfUtil.addScript("csExportHandler()");
    public void handleExport(FacesContext context, OutputStream out) {
            ComplianceLibraryAMImpl am = getDataController();
            HttpServletRequest request =
                (HttpServletRequest)context.getExternalContext().getRequest();
            Locale locale = NLSUtil.getClientLocale(request);
            ResourceBundle rb =
                ResourceBundle.getBundle("oracle.sysman.core.gccompliance.view.CoreGccomplianceUiMsg",
                                         locale);
            PreparedStatement st =
                am.getDBTransaction().createPreparedStatement("commit", 1);
            Connection conn = null;
            boolean isAgentSideCs = false;
            try {
                conn = st.getConnection();
                RichTable oTable = getCsTable();
                fileName = "ComplianceStandard.xml";
                List<Raw> exportGuids = new ArrayList<Raw>();
                for (Object opaqueFacesRowKey : oTable.getSelectedRowKeys()) {
                    oTable.setRowKey(opaqueFacesRowKey);
                    Object o = oTable.getRowData();
                    JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding)o;
                    exportGuids.add((Raw)rowData.getRow().getAttribute("CsGuid"));
                    int csType = ((oracle.jbo.domain.Number)rowData.getRow().getAttribute("CsType")).intValue();
                    if(csType == 4)
                        fileName =
                                (String)rowData.getRow().getAttribute("CsDname") + ".zip";
                        isAgentSideCs = true;
                    else
                        fileName =
                                (String)rowData.getRow().getAttribute("CsDname") + ".xml";
                    if(((Integer)rowData.getRow().getAttribute("IsSystem")).intValue() == 1){
                        throw(new ParseException(50));
                if (exportGuids.size() > 1)
                    fileName = "Compliancestandard_list.xml";
                RAW guid = new RAW(exportGuids.get(0).toString());
                if(isAgentSideCs)
                    getDataController().exportStandardContent(conn, out, guid);
                else
                    CsExport csexport = new CsExport(false);
                    csexport.doCsExport(conn, guid, false, out);
            } catch (ParseException e) {
                String errMsg = "";
                String errHdr = "";
                if(e.getStatus() == 50){
                    errMsg = rb.getString("ERRMSG_ISSYSTEMENTITY_EXPORT");
                    errHdr = rb.getString("ERRHDR_ISSYSTEMENTITY_EXPORT");
                else{
                    errMsg = rb.getString("ERRMSG_EXPORT_CS");
                    errHdr = rb.getString("ERRHDR_EXPORT_CS");
                AdfUtil.showMessageDialog(null, AdfUtil.MESSAGE_TYPE.ERROR, errHdr,
                                          errMsg, false, null);
                throw new RuntimeException(e);
            } catch (SQLException e) {
                throw new RuntimeException(e);
            } finally {
                JDBCUtil.close(st);
            MimeUtil mimeUtil = new MimeUtil();
            mimeUtil.downloadFile(context, fileName);
            try {
                out.flush();
                out.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
    Class MimeUtil:
    public void downloadFile(FacesContext context, String fileName) {
            HttpServletResponse httpServletResponse =
                (HttpServletResponse)context.getExternalContext().getResponse();
            HttpServletRequest httpServletRequest =
                (HttpServletRequest) context.getExternalContext().getRequest();
            String unicodeFileName = fileName;
            String agent = httpServletRequest.getHeader("USER-AGENT").toLowerCase(Locale.US);
            boolean isIE = false;
            if (null != agent && -1 != agent.indexOf("msie"))
                isIE = true;
            //encode the output file name to support NLS
            unicodeFileName = MimeUtil.encodeFileName(fileName, isIE);
            httpServletResponse.setHeader("Content-disposition",
                                          "attachment;filename=\"" + unicodeFileName +
    httpServletResponse.setContentType("application/x-download");
            context.responseComplete();
            httpServletResponse.setContentType("application/x-download");
            context.responseComplete();
    Now when i come to the page for first time and select a row and click on Export then the filename that gets shown in save file dialog is incorrect (it shows partial adf taskflow name) , but when i select the row again by clicking on any other row and click export it shows correct filename i.e. selectedRowName.zip or .xml according to type of row selected.
    Can anybody suggest what am i missing?

    difficult to tell like this.but better you debug your code then you can get where you getting filename wrong.

  • JDev 11g-Multiple Row Selection Table-Ctrl+A error

    Hello All,
    Jdeveloper : Studio Edition Version 11.1.1.2.0, Build JDEVADF_11.1.1.2.0_GENERIC_091029.2229.5536
    ADF Business Components : 11.1.1.55.36
    Java(TM) Platform : 1.6.0_11
    Oracle IDE: 11.1.1.2.36.55.36
    SOA Composite Editor: 11.1.1.2.0.12.16
    Versioning Support: 11.1.1.2.36.55.36
    I am trying to remove the selected rows from the table with RowSelection property set to Multiple. I am able to select the rows using by holding key board Ctrl key and click on the rows. The following code in backing bean successfully deletes the rows selected using this step.
    public void removeGeoSpecs(ActionEvent actionEvent)
    RowKeySet rowKeySet = getGmemTbl().getSelectedRowKeys();
    CollectionModel collectionModel =
    (CollectionModel) getGmemTbl().getValue();
    for (Object facesTreeRowKey: rowKeySet)
    collectionModel.setRowKey(facesTreeRowKey);
    JUCtrlHierNodeBinding rowData =
    (JUCtrlHierNodeBinding) collectionModel.getRowData();
    rowData.getRow().remove();
    But when i select all the rows in the table using Ctrl+A, all the rows got selected. I hit the Remove button, then after deleting the first row, getting the following error.
    javax.servlet.ServletException: ADFv: Could not find row: USA 548 with key: oracle.jbo.Key[] inside parent: GeoSpecTVOIterator with key: null.
    Caused by: java.lang.IllegalStateException: ADFv: Could not find row: USA 548 with key: oracle.jbo.Key[] inside parent: GeoSpecTVOIterator with key: null.
    Here USA 548 is my first row's data. Please let me know if you want complete error stack.
    During design time, While drag and drop the table i have not selected Row Selection check box as it sets property for single row selection. Table is inside the <af:panelCollection> . Here is the table source.
    <af:table value="#{bindings.GeoSpecTVO.collectionModel}" var="row"
    rows="#{bindings.GeoSpecTVO.rangeSize}"
    emptyText="#{bindings.GeoSpecTVO.viewable ? 'No data to display.' : 'Access Denied.'}"
    fetchSize="#{bindings.GeoSpecTVO.rangeSize}"
    rowBandingInterval="0" id="GmemTbl"
    partialTriggers=":::AddRowsBtn :::AddRangeBtn ::RemoveBtn :::SaveBtn"
    rowSelection="multiple"
    binding="#{backingBeanScope.GeoGrpSpecBean.gmemTbl}">
    Here GeoSpecTVO is a transient view object which is not having query and not attached with EO.
    I tried to fix this issue by myself and also searched for similar issues in the FORUM and google. But no luck... I very much appreciate all your inputs/pointers. Kindly let me know if you need additional information.
    Thanks
    Annadurai.

    Hi Annadurai
    I tried the same work around but still i am facing the issue, could you please help me.
    public void deleteRec(ActionEvent actionEvent) {
    // Add event code here...
    RowKeySet rowKeySet = (RowKeySet)this.embossTB.getSelectedRowKeys();
    CollectionModel cm = (CollectionModel)this.embossTB.getValue();
    Row specRow = null;
    ArrayList rowList = new ArrayList();
    int listLength = 0;
    ArrayList<Number> printReqLST=new ArrayList<Number>();
    ViewObject vo1=null;
    boolean flag=false;
    for (Object facesTreeRowKey : rowKeySet) {
    cm.setRowKey(facesTreeRowKey);
    JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding)cm.getRowData();
    specRow = rowData.getRow();
    rowList.add(specRow);
    listLength++;
    for (int index = 0; index < listLength; index++){
    specRow = (Row)rowList.get(index);
    Number printReqID = (Number)specRow.getAttribute("PrintRequestId");
    String PrintState = specRow.getAttribute("PrintState").toString();
    if (PrintState.equalsIgnoreCase("PRINTED")) {
    System.out.println("cann't delete");
    FacesContext fctx = FacesContext.getCurrentInstance();
    FacesMessage message =
    new FacesMessage("Cann't Delete the selected row:" + printReqID);
    message.setSeverity(FacesMessage.SEVERITY_ERROR);
    fctx.addMessage(null, message);
    } else {
    System.out.println("delete");
    flag=true;
    specRow.remove();
    if(flag){
    System.out.println("before commit");
    commitRows();
    }

  • Changing row selection of a af:table component in a managed bean

    Hi,
    how can ich programmatically change the selected row of a <af:table> component within a managed bean class?
    I have a table which depends on the date settings of a <dvt:timeSelector> of a <dvt:lineGraph> component. Now when the timeSelector is moved to new dates the table should be refreshed by executing the query for the table again with the new dates. The problem is when the query of the table's view object is executed again the first row will be automatically selected after executing.
    Now I want to achieve that the last row I have selected will be selected again after moving the time selector.
    I searched already in the OTN Discussion Forum but didn't find a fitting solution.
    Thanks in advance!

    The problem is that executing the query moves the current roe to the first one.
    What you can do is to save the current row (its pk), execute the query and then set the current row to the pk of the saved selected one. Set the table attribute displayRow="selected" and set the selected row of the table to the now current row.
    One problem is that you have to be sure the last selected row is still in the record set of the new query result.
    Here are some pointers with code:
    Keep the scroll position on partial commit in <af:table>
    Jdev 11G ADF BC: rollback and keeping current row problem
    How can I programmatically select row to edit in ADF - 11g
    Timo

  • Multiple row selection & Send Email Code ? Need littel Help

    Dear All,
    I managed to insert a code which will enable me to select multiple rows (Artikel from the great Yann Duran),
    i also have a code which enables me to send a mail for each selected row (only one row).
    But now since I was able to select more rows, I need to to customize my "Send mail" code to send mail to all selected rows. I guess I will need a loop here but I am not sure.
    My code for multiy row selection :
    private const string _CONTROL = "vw_CustLedgerEntry" // This is my Data Grid;
    private DataGrid _ItemsList = null;
    private int _SelectedRowsCount = 0;
    partial void Part_2_CustomerItemDetail_InitializeDataWorkspace(List<IDataService> saveChangesTo)
    // Write your code here.
    this.FindControl(_CONTROL).ControlAvailable += Orders_ControlAvailable;
    private void Orders_ControlAvailable(object sender, ControlAvailableEventArgs e)
    _ItemsList = e.Control as DataGrid;
    //if the cast failed, just leave, there's nothing more we can do here
    if (_ItemsList == null)
    return;
    //set the property on the grid that allows multiple selection
    _ItemsList.SelectionMode = DataGridSelectionMode.Extended;
    _ItemsList.SelectionChanged += new SelectionChangedEventHandler(_ItemsList_SelectionChanged);
    private void _ItemsList_SelectionChanged(object sender, SelectionChangedEventArgs e)
    switch (_ItemsList == null)
    case true:
    _SelectedRowsCount = 0;
    break;
    case false:
    _SelectedRowsCount = _ItemsList.SelectedItems.Count;
    break;
    This is my code for sending a mail for one selected row:
    partial void EMail_Execute() // EMAIL BUTTON FOR OPEN ENTRIES
    if (vw_CustLedgerEntry.SelectedItem.Report_Type == null)
    // throw new ArgumentNullException();
    this.ShowMessageBox("EMail Can't be sent,PDF generation is not possible for this Entry");
    this.Application.ShowPart_2_CustomerItemDetail(this.vw_CustomerItem.Costomer_No_, this.vw_CustomerItem.Company);
    else// if (vw_CustLedgerEntry.SelectedItem.Send_Mail== true)
    //do
    vw_CustLedgerEntryItem1 entryItem = this.vw_CustLedgerEntry.SelectedItem;
    InvSendbyMailRequestBody reqBody = new InvSendbyMailRequestBody(
    entryItem.Document_No_
    , entryItem.Report_Type
    , "DynNavHRS"
    , this.Application.User.Name.Replace(@"HRS\", "") + "@hrs.com" // HRS001
    , "Document"
    , false
    , false
    , this.vw_CustomerItem.ISO_Code // Change 7.8.2014 Bug in Email body text sprache
    , this.vw_CustomerItem.Salesperson_E_mail // Change 7.8.2014 Bug in Send E-mail
    , entryItem.Customer_No_.ToString()
    , false
    , "XYZ"
    , false);
    InvSendbyMailRequest req = new InvSendbyMailRequest(reqBody);
    HRSReportServiceSoapClient wsHRS = new HRSReportServiceSoapClient();
    // wsHRS.InvSendbyMailCompleted += new EventHandler<InvSendbyMailCompletedEventArgs>(wsHRS_InvGetPDFCompleted);
    wsHRS.InvSendbyMailAsync(req);
    this.ShowMessageBox("Your email was successfully sent");
    // while (vw_CustLedgerEntry.SelectedItem.Send_Mail == true);
    Thaks a lot for your help.
    Zayed

    I tried the following but I donot know if its correct and Iam facing a problem with the "Foreach" function.
    private const string _CONTROL = "vw_CustLedgerEntry" // This is my Data Grid;
    private DataGrid _ItemsList = null;
    private int _SelectedRowsCount = 0;
    partial void Part_2_CustomerItemDetail_InitializeDataWorkspace(List<IDataService> saveChangesTo)
    // Write your code here.
    this.FindControl(_CONTROL).ControlAvailable += Orders_ControlAvailable;
    private void Orders_ControlAvailable(object sender, ControlAvailableEventArgs e)
    _ItemsList = e.Control as DataGrid;
    //if the cast failed, just leave, there's nothing more we can do here
    if (_ItemsList == null)
    return;
    //set the property on the grid that allows multiple selection
    _ItemsList.SelectionMode = DataGridSelectionMode.Extended;
    _ItemsList.SelectionChanged += new SelectionChangedEventHandler(_ItemsList_SelectionChanged);
    private void _ItemsList_SelectionChanged(object sender, SelectionChangedEventArgs e)
    switch (_ItemsList == null)
    case true:
    _SelectedRowsCount = 0;
    break;
    case false:
    _SelectedRowsCount = _ItemsList.SelectedItems.Count;
    break;
    partial void Send_Multiple_Mail_CanExecute(ref bool result)
    //only enable rows have actually been selected
    result = (_SelectedRowsCount > 0);
    partial void Send_Multiple_Mail_Execute()
    if (_ItemsList == null) { return; }
    //StringBuilder names = new StringBuilder();
    //loop through the selected rows
    //we're casting each selected row as a DemoItem
    //so we get access to all the properties of the entity that the row represents
    foreach (_ItemsList.SelectedItems)
    vw_CustLedgerEntryItem1 entryItem = this.vw_CustLedgerEntry.SelectedItem;
    InvSendbyMailRequestBody reqBody = new InvSendbyMailRequestBody(
    entryItem.Document_No_
    , entryItem.Report_Type
    , "DynNavXYZ"
    , this.Application.User.Name.Replace(@"HRS\", "") + "@hrs.com" // HRS001
    , "Document"
    , false
    , false
    , this.vw_CustomerItem.ISO_Code // Change 7.8.2014 Bug in Email body text sprache
    , this.vw_CustomerItem.Salesperson_E_mail // Change 7.8.2014 Bug in Send E-mail
    , entryItem.Customer_No_.ToString()
    , false
    , "XYZ"
    , false);
    InvSendbyMailRequest req = new InvSendbyMailRequest(reqBody);
    XYZReportServiceSoapClient wsHRS = new HRSReportServiceSoapClient();
    // wsHRS.InvSendbyMailCompleted += new EventHandler<InvSendbyMailCompletedEventArgs>(wsHRS_InvGetPDFCompleted);
    wsHRS.InvSendbyMailAsync(req);
    this.ShowMessageBox("Your email was successfully sent");

  • Small issue with custom table cell editor and unwanted table row selection

    I'm using a custom table cell editor to display a JTree. Thing i notice is that when i select a value in the tree pop-up, the pop-up closes (as it should) but then every table row, from the editing row to the row behind the pop-up when i selected the value becomes highlighted. I'm thinking this is a focus issue, but it thought i took care of that. To clairfy, look at this: Before . Notice how the "Straightening" tree item is roughly above the "Stock Thickness" table row? When i select Straightening, this is what happens to my table: After .
    My TreeComboBox component:
    public class TreeComboBox extends JPanel implements MouseListener {
        private JTextField itemField;
        private TreeModel treeModel;
        private ArrayList<ActionListener> actionListeners = new ArrayList<ActionListener>();
        private Object selectedItem;
         * Creates a new <code>TreeComboBox</code> instance.
         * @param treeModel the tree model to be used in the drop-down selector.
        public TreeComboBox(TreeModel treeModel) {
            this(treeModel, null);
         * Creates a new <code>TreeComboBox</code> instance.
         * @param treeModel the tree model to be used in the drop-down selector.
         * @param selectedItem tree will expand and highlight this item.
        public TreeComboBox(TreeModel treeModel, Object selectedItem) {
            this.treeModel = treeModel;
            this.selectedItem = selectedItem;
            initComponents();
         * Returns the current drop-down tree model.
         * @return the current <code>TreeModel</code> instance.
        public TreeModel getTreeModel() {
            return treeModel;
         * Sets the tree model.
         * @param treeModel a <code>TreeModel</code> instance.
        public void setTreeModel(TreeModel treeModel) {
            this.treeModel = treeModel;
         * Returns the selected item from the drop-down selector.
         * @return the selected tree object.
        public Object getSelectedItem() {
            return selectedItem;
         * Sets the selected item in the drop-down selector.
         * @param selectedItem tree will expand and highlight this item.
        public void setSelectedItem(Object selectedItem) {
            this.selectedItem = selectedItem;
            String text = selectedItem != null ? selectedItem.toString() : "";
            itemField.setText(text);
            setToolTipText(text);
         * Overridden to enable/disable all child components.
         * @param enabled flat to enable or disable this component.
        public void setEnabled(boolean enabled) {
            itemField.setEnabled(enabled);
            super.setEnabled(enabled);
        public void addActionListener(ActionListener listener) {
            actionListeners.add(listener);
        public void removeActionListener(ActionListener listener) {
            actionListeners.remove(listener);
        // MouseListener implementation
        public void mouseClicked(MouseEvent e) {
        public void mouseEntered(MouseEvent e) {
        public void mouseExited(MouseEvent e) {
        public void mousePressed(MouseEvent e) {
        public void mouseReleased(MouseEvent e) {
            showPopup();
        private void initComponents() {
            setLayout(new GridBagLayout());
            itemField = new JTextField();
            itemField.setEditable(false);
            itemField.setText(selectedItem != null ? selectedItem.toString() : "");
            itemField.addMouseListener(this);
            add(itemField, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0,
                    GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
        private void showPopup() {
            final TreePopup popup = new TreePopup();
            final TreeComboBox tcb = this;
            final int x = itemField.getX();
            final int y = itemField.getY() + itemField.getHeight();
            int width = itemField.getWidth() + popupButton.getWidth();
            Dimension prefSize = popup.getPreferredSize();
            prefSize.width = width;
            popup.setPreferredSize(prefSize);
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    popup.show(tcb, x, y);
                    popup.requestFocusInWindow();
        private void fireActionPerformed() {
            ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "TreeComboBoxSelection");
            for (ActionListener listener : actionListeners) {
                listener.actionPerformed(e);
        private class TreePopup extends JPopupMenu {
            private JTree tree;
            private JScrollPane scrollPane;
            public TreePopup() {
                initComponents();
                initData();
            private void initData() {
                if (treeModel != null) {
                    tree.setModel(treeModel);
            private void initComponents() {
                setFocusable(true);
                setFocusCycleRoot(true);
                tree = new JTree();
                tree.setRootVisible(false);
                tree.setShowsRootHandles(true);
                tree.setFocusable(true);
                tree.setFocusCycleRoot(true);
                tree.addTreeSelectionListener(new TreeSelectionListener() {
                    public void valueChanged(TreeSelectionEvent e) {
                        tree_valueChanged(e);
                scrollPane = new JScrollPane(tree);
                add(scrollPane);
            private void tree_valueChanged(TreeSelectionEvent e) {
                DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
                setSelectedItem(node.getUserObject());
                fireActionPerformed();
                this.setVisible(false);
    }My TreeComboBoxTableCellEditor:
    public class TreeComboBoxTableCellEditor extends AbstractCellEditor implements TableCellEditor, ActionListener {
        protected TreeComboBox treeComboBox;
        protected ArrayList<CellEditorListener> cellEditorListeners = new ArrayList<CellEditorListener>();
        public TreeComboBoxTableCellEditor(TreeComboBox treeComboBox) {
            this.treeComboBox = treeComboBox;
            treeComboBox.addActionListener(this);
        public Object getCellEditorValue() {
            return treeComboBox.getSelectedItem();
        public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
            treeComboBox.setSelectedItem(value);
            return treeComboBox;
        public void actionPerformed(ActionEvent e) {
            stopCellEditing();
    }Any thoughts?
    Edited by: MiseryMachine on Apr 3, 2008 1:21 PM
    Edited by: MiseryMachine on Apr 3, 2008 1:27 PM

    As I said, you have to have empty context elements before additional rows will be open for input.
    For instance if you want to start with 5 rows available for input do the following to your internal table that you will bind:
    data itab type standard table of sflight.
    do 5 times.
      append initial line to itab.
    enddo.
    context_node->bind_table( itab ).
    The other option if you need n number of rows is to add a button to the table toolbar for adding more rows. When this button is pressed, you add a new context element to the node - thereby creating a new empty row in the table.

Maybe you are looking for