RowKeySet is Empty for first row

Hi all,
I am trying to get a table's current row(row is selected with mouse click or arrow down/up) in a bean.With my current code, it works except that if the first row is selected, rowKeySet is null. Any ideas why is it so?
Any pointers are appreciated.
Table code
<af:table value="#{bindings.Department.collectionModel}" var="row"
rows="#{bindings.Department.rangeSize}"
emptyText="#{bindings.Department.viewable ? 'No rows yet.' : 'Access Denied.'}"
fetchSize="#{bindings.Department.rangeSize}"
selectedRowKeys="#{bindings.Department.collectionModel.selectedRow}"
selectionListener="#{GetRowBean.selectedRow}"
rowSelection="single" binding="#{GetRowBean.table}">
Bean code(GetRowBean)
public void selectedRow(SelectionEvent SelectionE){
RowKeySet rowKeySet = table.getAddedSet();
if(rowKeySet != null){
if(rowKeySet.isEmpty() == false){
for(Object tableRowKey: rowKeySet){
table.setRowKey(tableRowKey);
FacesCtrlHierNodeBinding rowData =
(FacesCrtlHierNodeBinding)this.table.getRowData();
Row currRow = rowData.getRow();
DepartmentId = (Integer)currRow.getAttribute("DepartmentId");
Thank you for your time.

Hi Frank,
I am using ADF BC. In my current implementation, I believe that I want the selected row instead of the current row.
May be there are better alternatives to implement the code to retrieve the selected row(mouse click or arrow up/bottom)? Why is the rowKeySet empty if the first row is selected?
Any pointers are appreciated.
Thank you for your time.

Similar Messages

  • Default value for first row in table after row has rendered

    I have a master-detail type page where the first row in the detail table appears with no values when the page first renders. After the user enters some data in the master area, the default value is available. I then use something like this to set the default in one column of the first row:
    MyVOImpl vo = (MyVOImpl)am.getMyVO1();
    MyRowImpl voRow = (MyRowImpl)vo.first();
    voRow.setMyAttribute("some value");
    When I do this and run the code in the debugger, I can see that the default value is stored somewhere in the row object. However, the value is not displayed in the screen.
    What must I do to get the default value to display after the user has tabbed out of the master data area, and before the user attempts to enter data in the row?

    Hi. Thanks again.
    Here is more detail of the code:
    if (pageContext.isLovEvent())
    * Form was submitted because the user selected
    * a value from the LOV modal window,
    * or because the user tabbed out of the LOV input.
    * This code executes when the event is either
    * LOV_UPDATE or LOV_VALIDATE
    String lovInputSourceId = pageContext.getParameter(SOURCE_PARAM)
    // Find out the result values of the LOV.
    Hashtable lovResults =
    pageContext.getLovResultsFromSession(lovInputSourceId);
    // Find out which LOV input triggered the event.
    if (lovInputSourceId.equals("myLovItemId"))
    String myDefaultVar = null;
    if (lovResults != null)
    myDefaultVar = "some stuff " + (String)lovResults.get("myResultItemId")
    if (myDefaultVar != null && myDefaultVar != "") // yes, this is always true in this case
    // now set the default for the first line.
    // Added lines will be defaulted by the
    // EO.create() method.
    MyVOImpl myVo = (MyVOImpl)am.getMyVO1();
    MyVORowImpl myVoRow = (MyVORowImpl)myVo.first();
    myVoRow.setAttribute("myRowItemId", myDefaultVar); // THIS LINE DOES NOT CAUSE DISPLAY TO CHANGE
    The problem, as noted in the code, is that setAtrribute() does not cause the default value to display in the field.
    What can cause this, and what can fix it?
    Edited by: user522137 on Nov 9, 2010 12:06 PM

  • EditCellAt() with mouseclick is not working for first row of the jtable

    Hi All,
    I have extended JTable.changeSelection() & editCellAt() methods to force the text to select when focus is brought to the cell.
    I have a page which has both editable and non-editable columns. when I do a mouse click on FIRST ROW of the editable cell and type the value, The value is not displayed in the cell. when I click on any other editable field in the page, The typed value is displayed in the cell. In the first row of the cell, only the first attempt is not working. When I remove the editCellAt() call in changeSelection(), it works as expected.
    But, If I reach the FIRST ROW editable cell using TAB key instead of Mouse click and type the value, its working fine.
    Kindly suggest me what could be the problem in my code. I think something wrong in editcellat() or mouseclicked/released or focusgained in our versions of JTable or jtextfield.
    Kindly let me know if you need any more functions of my version of implementation.
    Thanks In advance.
    My JTable Version of editCellAt:
         public boolean editCellAt(int row, int column, EventObject e) {
              try {
                   if (getCellEditor() != null && !getCellEditor().stopCellEditing()) {
                        return false;
                   if (!isCellEditable(row, column)) {
                        return false;
                   if (isShowStarRow() /*&& !starRowAdded*/) {
                        VSDataControl ds = getDataSource();
                        if (ds != null) {
                             VSResultSet rs = ds.getResultSet();
                             if (rs != null) {
                                  if (row == rs.getRowCount()) { // This is the star row
                                       // Go to the last record
                                       if (row > 0) {
                                            try {
                                                 rs.getRowAt(row + 1, true);
                                                 rs.last();
                                            } catch (Exception ex) {
                                                 return false;
                                       if (ds.insert() == null) {
                                            return false;
                                       currentRow = row + 1;
                                       starRowAdded = true;
                   TableCellEditor editor = getCellEditor(row, column);
                   if (editor != null && editor.isCellEditable(e)) {
                        editorComp = prepareEditor(editor, row, column);
                        if ( editorComp instanceof VSGridChoice && lastKeyEvent != null ) {
                             VSGridChoice choice = (VSGridChoice) editorComp;
                             choice.handleMissingCharEvent( lastKeyEvent );
                        if (editorComp instanceof VSChoiceBase && lastKeyEvent != null ) {
                             VSChoiceBase hack = (VSChoiceBase)editorComp;
                             hack.addMissingChar(lastKeyEvent);
                        lastKeyEvent = null;
                        if (editorComp == null) {
                             removeEditor();
                             return false;
                        editorComp.setBounds(getCellRect(row, column, false));
                        add(editorComp);
                        editorComp.validate();
                        editorComp.requestFocus();
                        setCellEditor(editor);
                        setEditingRow(row);
                        setEditingColumn(column);
                        editor.addCellEditorListener(this);
                        return true;
                   return false;
              } catch (Exception ex) {
                   showValidationError(e, ex);
                   return false;
         public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend)
              super.changeSelection(rowIndex, columnIndex, toggle, extend);
                    editCellAt(rowIndex, columnIndex);
                           if (getEditorComponent() != null)
                   if (getEditorComponent() instanceof CustomJTextField)
                        ((CustomJTextField)getEditorComponent()).selectAll();
          }

    i will suggest you to override your requetFocus()
    like.
    public void requestFocus()
            super.requestFocus(); // may be panel or container.
            textPane.setSelectionStart(0); // textpane is the editor for the cell.
            textPane.setSelectionEnd(textPane.getText().length());
        } Gud luck.

  • Change background and font for first row only?

    Hi, 
    Have a tablix in SSRS (2008R2) and would like to change the background colour and font for the first row only, is this possible and if so how would I achieve this? 
    I have followed and example on setting alternate row background colour in the properties but can't see how to do this for just the first row. 
    =IIF(RowNumber(Nothing) MOD 2,”LightGrey”, “LightBlue”)
    Thanks 

    Hello,
    The Expression uses a Modulo function to calculate every second row. In your case just compare with equal 1 for the first row:
    =IIF(RowNumber(Nothing) = 1, ”LightGrey”, “LightBlue”)
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • CreateRowFromResultSet not called for first row

    Hi all,
    Jdev Version: 11.1.1.7.0
    I have an XML stored in DB as  a CLOB. I fetch this XML as a CLOB (using clobdomain) in my VO and need to populate a few other transient attributes. I attempted to achieve this by overriding (as per blog entry) method 'createRowFromResultSet'. I observe a weird behaviour where this method does not get invoked for the first row alone.
    A while back, I see another member suffer from a similar issue - forum thread. Is this a bug that appears when using clob and overriding this method?
    Thanks in advance,
    Srini

    Hi,
    we have the same problem. The method createRowFromResultSet() is not called for the first row. We don't have a CLOB. We have a primary key of type Raw. Maybe this is causing the problem.
    We are using JDev 11.1.1.6.
    Regards,
    Linda

  • Transport request for table changes is asked only for first row changed

    Hello,
    We have created a maintenance dialog connected to a custom table.
    In the Table Maintenance Diagog, the <i>Dialog Data Transport Details</i> is set to <i>Standard Recording Routine</i>.
    In the "Maintenance Objects" screen, the transport is set to "Automatic transport".
    Two questions:
    1. Now can I only change the table's entry through SM30? I do not see the "pencil" icon in SM11 or SM16 anymore. Is there a way to change the table's rows in both ways?
    2. When I change a row in my table through SM30, the system only asks for the CR number the FIRST time that I savea changed row. When I change other rows and save them, it does not ask for any CR that I want to use for transport. Does it mean that the system automatically knows where to put the transported rows? or that the configuration is wrong and the other changed rows will not be taken into consideration? What if I want to change the CR for only some of the changed rows?
    Thank you very much every expert here

    HI,
    The table should be Customizeed table, i mean in the Attributes of the tabl eput it as C,
    1) We can change/Insert the records from SM30, we can not ahve the pencil icon in SE11 or SM16
    2) If you put the table type C, then for every entry it should ask the CR, if not then it is moving to the same request automatically
    Regards
    Sudheer

  • Disable First Row in property loader

    Hi,
    TestStand 2.0.1f1
    I am trying to use the property loader with the option 'First Row of Data Specifies Step Property for Each Column' unchecked.
    I have followed the example text as outline in the User manual Ch8 page69.
    But it seems that the step name is always being checked. I have tried a number of varations but I can not get the property loader to ignore the Step Name.
    I have attached an example with a limit file. Any clues anyone.
    Regards
    Ray Farmer
    Regards
    Ray Farmer
    Attachments:
    Disable_the_First_Row.seq ‏26 KB
    Disable_first_row.txt ‏1 KB

    Ray,
    Using the Property Loader and Import/Export Properties Tool, you have to specify the Step Name. There is no way to ignore the Step Name.
    After reading over the help, I think the confusion may be over what the "First Row of Data Specifies Step Property for Each Column" option means. If you do not check that option (it is selected by default), then you can specify the order of the properties and data values that you will read in from the file. This may be of help because the Import/Export Properties tool does not allow you to modify the order of the properties that are exported.
    For example, if you use the Import/Export Properties tool to export Step.Limits.Comp, Step.Limits.High, and Step.Limits.Low properties to a text file, they will always be written to the file in that exact order (Step.Limits.Comp, Step.Limits.High, and Step.Limits.Low).
    Now if you use the Property Loader to read in that file that you just created, it will automatically map those properties to Step.Limits.Comp, Step.Limits.High, and Step.Limits.Low for a specific step name. If you need to switch the values received in the Property Loader step, you can deselect the checkbox for "First Row of Data Specifies Step Property for Each Column" and instead specify which properties should be associated with those columns from the file. For example, you could deselect the checkbox and then type in the text box:
    Comp, Limits.Low, Limits.High
    This would switch the Low and High data values, ignoring the column titles as written from the Import/Export Properties Tool. If you wanted to, you could even delete or modify the column titles in whatever manner you want to.
    Keep in mind that you still need to have an entry in your properties file for each step name in the sequence that has dynamically loaded values. TestStand will not load properties and apply them to generic steps; the step name is the key for the Property Loader tool.
    I hope this answers your question. If you need further clarification or if I missed a point, just let us know!
    Regards,
    Shannon R.
    Applications Engineer
    National Instruments

  • Current VO row is empty for flexfield

    I am implementing "Address Location" DFF and I am getting the below error message when testing.
    Current VO row is empty for flexfield
    I made sure that the VO is initialized. Populated the VO instance and segment list too
    vo.setMaxFetchSize(0);
    vo.executeQuery();
    vo.insertRow(vo.createRow());
    OARow row = (OARow)vo.first();
    Any suggestions?

    hi,
    Please share more details and put some SOPs to check values for OARow row = (OARow)vo.first(); and other places.

  • First row is empty in draft document

    I have created a DI addon for posting a draft delivery document.  However, in each document there's a empty blank row.  I know that you only need to invoke the lines.add function for second plus rows so I have already made sure that I am not adding a new line on first add.  Any advice for you would much be appreciated.
    Regards
           Dim retVal As Object
            Dim i As Integer = 0
            Dim oDeliveryDoc As SAPbobsCOM.Documents
            oDeliveryDoc = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDrafts)
            oDeliveryDoc.DocObjectCode = SAPbobsCOM.BoObjectTypes.oDeliveryNotes
            oDeliveryDoc.CardCode = selectedBPCode
            oDeliveryDoc.DocDueDate = Today
            Dim row As Object
            While i < CType(DataGrid1.DataSource, DataTable).Rows.Count
                If DataGrid1.IsSelected(i) Then
                    If i > 0 Then
                        oDeliveryDoc.Lines.Add()
                    End If
                    oDeliveryDoc.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
                    oDeliveryDoc.Lines.BaseEntry = CInt(DataGrid1.Item(i, 8))
                    oDeliveryDoc.Lines.BaseLine = DataGrid1.Item(i, 9)
                End If
                i = i + 1
            End While
            retVal = oDeliveryDoc.Add
            If retVal <> 0 Then
                oCompany.GetLastError(lErrCode, sErrMsg)
                MsgBox(lErrCode & " " & sErrMsg)
            End If

    Hi Alan,
    The blank row that you are referring to, where is that line? Is it the last line in the document? If so, that is standard SBO practice. I tested your code and did the same in SBO itself. I create a Delivery draft with 3 lines and 4 lines are added to the document. The fourth line is the new line that is created automatically when you press tab. The reason is that you can add more lines to a draft document. As soon as you save that draft as an actual document, the last line gets deleted.
    Hope it helps,
    Adele
    Message was edited by: Adele le Roux
    Didn't read properly... see that it's the first row that's empty... Should your code not read:
    If i > 1 Then

  • We can able to load master data through manually FIRST ROW IS EMPTY

    Hi,
        we can able to load master data through manually without loading but in that screen where we we type the data FIRST ROW IS EMPTY.PLZ tell me why that is empty

    Becasue SAP BW already creates a Blank Line, it cannot create a new one again for you.
    So, when you loaded the Blank like with description, it uses the existing blank line and creates test for it.
    Each row in the table will have a SID.
    e.g.,
    12345 text1
    23446 text2
    You cannot have
    12345 text1
    12345 text2
    If you load the above, you will have "12345 text2" in the table.
    Same way, you cannot have two SIDs for the same key, so your new text is used for the existing Blank Key value.
    SAP creates this:
    Key, Description
    when you loaded the Master Data, you have:
    " ", "whatever you loaded".
    Edited by: Ananda Theerthan on Apr 27, 2010 7:03 AM

  • Why first row is empty?

    I've used the below code to populate 3 rows , but at run time first row will be empty after that next 3 rows will be populated.
    Why its not starting from the first row?
    IPrivateLogin_DCView.IEmpNode node1=wdContext.nodeEmp();
             int count=3;
         for(int i=0;i<count;i++){
                      IPrivateLogin_DCView.IEmpElement ele= wdContext.nodeEmp().getEmpElementAt(i);
                        ele=node1.createEmpElement();
                      if(i==0){
                         //  ele=node1.createEmpElement();
                           ele.setEmp_name("Deepa");
                           ele.setEmp_age("35");
                           ele.setEmp_no("1");
                           node1.addElement(ele);
                        if(i==1){
                         //  ele=node1.createEmpElement();
                           ele.setEmp_name("Raju");
                           ele.setEmp_age("32");
                           ele.setEmp_no("INFO 1");
                           node1.addElement(ele);
                        if(i==2){
                          // ele=node1.createEmpElement();
                           ele.setEmp_name("Rose");
                           ele.setEmp_age("42");
                           ele.setEmp_no("454 ");
                           node1.addElement(ele);

    Hi Rajashekhar,
    Try this.
    IPrivateLogin_DCView.IEmpNode node1=wdContext.nodeEmp();
    int count=4;
    for(int i=0;i<count;i++){
    IPrivateLogin_DCView.IEmpElement ele= wdContext.nodeEmp().getEmpElementAt(i);
    ele=node1.createEmpElement();
    if(i==0){
    ele.setEmp_name("");
    ele.setEmp_age("");
    ele.setEmp_no("");
    node1.addElement(ele);
    if(i==1){
    ele.setEmp_name("Deepa");
    ele.setEmp_age("35");
    ele.setEmp_no("1");
    node1.addElement(ele);
    if(i==2){
    ele.setEmp_name("Raju");
    ele.setEmp_age("32");
    ele.setEmp_no("INFO 1");
    node1.addElement(ele);
    if(i==3){
    ele.setEmp_name("Rose");
    ele.setEmp_age("42");
    ele.setEmp_no("454 ");
    node1.addElement(ele);
    Regards,
    Mithu

  • Get only the first row for duplicate data

    Hello,
    I have the following situation...
    I have a table called employees with column (re, name, function) where "re" is the primary key.
    I have to import data inside this table using an xml file, the problem is that some employees can be repeated inside this xml, that means, I'll have repeated "re"'s, and this columns is primary key of my table.
    To workaround, I've created a table called employees_tmp that has the same structed as employees, but without the constraint of primary key, on this way I can import the xml data inside the table employees_tmp.
    What I need now is copy the data from employees_tmp to employess, but for the cases where "re" is repeated, I just want to copy the first row found.
    Just an example:
    EMPLOYEES_TMP
    RE NAME FUNCTION
    0987 GABRIEL ANALYST
    0987 GABRIEL MANAGER
    0978 RANIERI ANALYST
    0875 RICHARD VICE-PRESIDENT
    I want to copy the data to make employees looks like
    EMPLOYEES
    RE NAME FUNCTION
    0987 GABRIEL ANALYST
    0978 RANIERI ANALYST
    0875 RICHARD VICE-PRESIDENT
    How could I do this?
    I really appreciate any help.
    Thanks

    Try,
    SELECT re, NAME, FUNCTION
      FROM (SELECT re,
                   NAME,
                   FUNCTION,
                   ROW_NUMBER () OVER (PARTITION BY re ORDER BY NAME) rn
              FROM employees_tmp)
    WHERE rn = 1G.

  • Getting the first row for each group

    Hi Everyone,
    I have a query which returns a number of rows, all of which are valid. What I need to do is to get the first row for each group and work with those records.
    For example ...
    client flight startairport destairport stops
    A fl123 LGW BKK 2
    A fl124 LHR BKK 5
    B fl432 LGW XYZ 7
    B fl432 MAN ABC 8
    .... etc.
    I would need to return one row for Client A and one row for Client B (etc.) but find that I can't use the MIN function because it would return the MIN value for each column (i.e. mix up the rows). I also can use the rownum=1 because this would only return one row rather than one row per group (i.e. per client).
    I have been investigating and most postings seem to say that it needs a second query to look up the first row for each grouping. This is a solution which would not really be practical because my query is already quite complex and incorporating duplicate subqueries would just make the whole thing much to cumbersome.
    So what I really new is a "MIN by group" or a "TOP by group" or a "ROWNUM=1 by group" function.
    Can anyone help me with this? I'm sure that there must be a command to handle this.
    Regards and any thanks,
    Alan Searle
    Cologne, Germany

    Something like this:
    select *
    from (
       select table1.*
       row_number() over (partition by col1, col2 order by col3, col4) rn
       from table1
    where rn = 1In the "partition by" clause you place what you normally would "group by".
    In the "order by" clause you define which will have row_number = 1.
    Edit:
    PS. The [url http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions004.htm#i81407]docs have more examples on using analytical functions ;-)
    Edited by: Kim Berg Hansen on Sep 16, 2011 10:46 AM

  • First row for each entry

    hi
    i have sorted the internal table by field f1 and i need to insert the first row for each f1 entry.
    I tried AT NEW f1. But that doesnt seem to work.
    Kindlly help.
    Thanks.

    *--ENSURE THAT age IS FIRST FIELD IN INTERNAL TABLE it_gir while declaring it.....
    SORT it_gir BY age ASCENDING.
    LOOP AT it_gir INTO wa_gir.
    AT NEW age.
    <b>*--if there are fields which are getting populated with **** instead of original values....then use below statement...</b>
    read table it_gir index sy-tabix.
    MOVE-CORRESPONDING wa_gir TO wa_final1.
    APPEND wa_final1 TO it_final1.
    clear wa_final1.
    ENDAT.
    ENDLOOP.
    now it should definitely work.....
    if not check in debugging mode if data exists or not....!!!
    Regards
    Vasu

  • Infopath submit button only works for the first row in a repeating table‏

    Hi, I have a InfoPath Email submit button issue I could not figure out. I have a master/detail repeating table in my form, and one of fields is "EmailAddress" which shows customer's email address. I created a submit button and put the "EmailAddress"
    field to "TO" object. When I tested it, the submit button only would return the first row of emailaddress from the repeating table, but not the rest of it..
    What I want is when I highlighted a customer, and click the submit button, the current customer's email address would show up in "TO" list. I did some research and saw some suggestions about using current() function. So I put current() in the front,
    like this:
    current()/dfs:dataFields/d:vw_HZLeadLists/@EmailAddress
    Still not working..Just return the first record of emailaddress from master repeating table... Does anyone know what's going on here? Thanks a lot!

    Hello,
    Use double eval to get all rows values. See my reply for more information in below thread:
    eval(eval(EmailAddress, 'concat(ToField, ";")'), "..")
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/cc22aeb7-351f-45a7-8a4c-94132c3e0db2/eval-semicolon-function-issue?forum=sharepointcustomizationprevious
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

Maybe you are looking for