Programmatically selecting some row - selectedItem is null

Hey guys
In my application, I have a datagrid that is bound to RemoteObject. The datagrid has a corresponding form that contains the details. When the user clicks on a row in the datagrid the form populates with the values from the DataGrid's selectedItem.
I want to programatically select some row in my DataGrid when the application loads.
In order to do this, I have to call validateNow() and scrollToIndex()
eg.
dg.selectedIndex = i; dg.validateNow();
dg.scrollToIndex(i);
I put this code in the Applications creationComplete handler.
This all works great - the desired row is highlighted and selected and the selectedIndex is i. The problem is that I can't access the data to populate the details form. When I try to retrieve the dg.SelectedItem property - it is null.
How does one programatically select some row in the grid on load AND access the row data?
thanks

Hey Alex,
Thanks for your reply.
I have searched this issue from Bug and Issue Management System.I did find a similar bug in <mx:List> ,see SDK-4782,But not Datagrid.I'm using SDK 3.2,is there any way to resolve it?

Similar Messages

  • How can i select some row from multiple row in the same group of data

    I want to select some row from multiple row in the same group of data.
    ColumnA        
    Column B
    1                  OK
    1                   NG
    2                   NG
    2                          NG
    3                          OK
    3                          OK
    I want the row of group of
    ColumnA if  ColumnB contain even 'NG'
    row , select only one row which  Column B = 'NG'
    the result i want = 
    ColumnA         Column B
    1                         NG
    2                   NG
    3                          OK
    Thank you

    That's some awful explanation, but I think this is what you were driving at:
    DECLARE @forumTable TABLE (a INT, b CHAR(2))
    INSERT INTO @forumTable (a, b)
    VALUES
    (1, 'OK'),(1, 'NG'),
    (2, 'NG'),(2, 'NG'),
    (3, 'OK'),(3, 'OK')
    SELECT f.a, MIN(COALESCE(f2.b,f.b)) AS b
    FROM @forumTable f
    LEFT OUTER JOIN @forumTable f2
    ON f.a = f2.a
    AND f.b <> f2.b
    GROUP BY f.a

  • Randomly selecting some rows from the database table

    Hi can some one help me in selecting some rows from a database table which has around 90,000 rows.
    Thanks.

    One thing you might try is the "sample" clause if you have 8i which is supposed to return a random percentage of the table. Say for example, you have a sequence number on your table as the pkey. Then you might try:
    select * from <table_name> where pkey in(select pkey from <table_name> sample(10));
    This should give you a random 10 percent of the rows in the table but I tried this once and the results seemed unpredictable. For example it returned a different number of rows each time even though the number of rows in the table didn't change.
    Hope this works for you.

  • Select some rows

    Hi
    I want to select some rows from a table say 10 rows once and next 10 rows next time
    I am using
    select * from <table_name> where rownum <= 10;
    It's giving me the proper results But how can i get next rows
    i have tried
    select * from <table_name> where rownum between 10 and 20;
    it's giving me 'no rows selected' even the table is containing the rows
    And i have one more doubt if i write
    select * from <table_name> where rownum = 1;
    it's giving me the result
    But when i write select * from <table_name> where rownum = n; where n is any number greater than 1 it's giving me again 'no rows selected' even i have so many rows in the table
    why is it so?
    Thanks in advance...

    Hi,
    If you want to get rows from 10 to 20 then you can use this query:
    select *
    from
         select select rownum rno,a.*
         from emp a
    where rno between 10 and 20Instead of 10 and 20 you can give your own values.
    Now coming to your doubt
    +select * from <table_name> where rownum = 1;+
    +it's giving me the result+
    +But when i write select * from <table_name> where rownum = n;
    where n is any number greater than 1 it's giving me again
    'no rows selected' even i have so many rows in the table+
    +why is it so?+For this you need to understand when a ROWNUM is assigned to a row.
    A ROWNUM is assigned to a row just after it satisfies the conditions we specify in the WHERE clause of the query.
    Note:ROWNUM starts with 1.
    So in the first case
    As is said earlier that +"A ROWNUM is assigned to a row just after it satisfies
    the conditions we specify in the WHERE clause of the query"+ ,
    the WHERE clause of your query is +"WHERE ROWNUM=1"+.
    Since ROWNUM starts with 1 ,this condition is satisfied and hence
    the row is assigned a ROWNUM of 1.
    After a ROWNUM is assigned to a row,then ROWNUM is incremented.
    Now the ROWNUM becomes 2.
    For the next record,again the WHERE clause is executed and this time
    the condition "WHERE ROWNUM =1 " becomes "WHERE 2=1"
    and hence the condition fails.
    This happens with all the rows from hereon.
    That is the reason why ROWNUM=1 always return a single row.
    Now Coming to the Second case
    The WHERE Clause is "where ROWNUM between 10 and 20".
    Again applying the same principle and keeping in mind the fact that
    ROWNUM starts with 1 and increments once it is assigned to a row:
    For the first record the WHERE caluse +"where ROWNUM between 10 and 20"+
    becomes +"WHERE 1 between 10 and 20"+,the condition fails and it
    goes to the next row and even for the remaining rows the conditions fails
    because since ROWNUM is not assigned to any row,ROWNUM is not incremented.
    That is the reason why +"no rows are returned"+ in this case.
    Edited by: Sreekanth Munagala on Nov 18, 2008 8:49 PM
    Edited by: Sreekanth Munagala on Nov 18, 2008 8:58 PM

  • Programmatically select multiple rows in DataGrid

    Hello,
    I'm trying to do it for days. How can i select many rows in my DataGrid in the code. In my DataGrid i have rows responsible for folders and files - existing in these folders. When user selects folder row i want to select all rows responsible for files that
    are in that folder. Of course i know which rows should be selected, but the problem is how to do it? I can add that my DataGrid is Binded to ObservableCollection(containing strings with pathes to different directories and files. Please some help.

    Hi Josef,
    I am marking this issue as "Answered". If you have any new questions or concerns about this issue, please feel free to let me know.
    Thank you and have a nice day!
    Min Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • ADF Faces & BC: Programmatic selection of row within a selectonechoice

    OK i did some printouts and it looks like its occuring on this line:
    diseaseDescriptionLOVVo.findByKey(new Key(keyValues), -1);
    Is there a better way to do this selection?

    findByKey only works when you are passing the exact primary Key of the row, you can also try using findByAltKey and try to specify an alternate key at the VO level.
    Juan C.

  • How do I create a Search Help which selects some rows from a table?

    Well, I'm trying to be specific.
    I have a parameter with a search help that shows columns BUKRS and BUTXT for ALL rows form the table T001. What I need is restrict the search help to show only three Values: BUKRS = 1000 BUKRS = 2000 BUKRS = 3000. This is like a search help with a SELECT sentence. How do I do it?

    Hi.,
    you can go through thomas sir's suggestion. But my suggestion is If you are working in a custom Report , dont change it at Table level or Domail Level., Instead, use Function Module for Custom F4 help.,
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_bukrs.
    CALL FM F4IF_INT_TABLE_VALUE_REQUEST.
    check this help for your reference: http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbaac935c111d1829f0000e829fbfe/content.htm.
    If you are using Standard Report Check for Exits.
    hope this helps u.,
    Thanks & Regards,
    Kiran

  • How to programatically select a row in TableBean and update its column?

    Hi,
    Can anyone help me on How to programmatically select a row in a TableBean and update its column?
    Thanks,
    Jon

    Hi,
    My requirement is I need to update a column in a particular row of the table using fire action...
    I have a datefield bean serve as birhdate and base on this I need to update the age column depending on the given dates..
    Here's my code under the Process form request for your reference...
    if (actionInMainPersonScreen.equals("changeDate"))
    String checkId = pageContext.getParameter("paramDatePersonId");
    OAFormValueBean depPerId = (OAFormValueBean)depTable.findIndexedChildRecursive("ChildPersonID");
    OAMessageTextInputBean depFName = (OAMessageTextInputBean)depTable.findIndexedChildRecursive("FirstName");
    OAMessageDateFieldBean dateBirth = (OAMessageDateFieldBean)depTable.findIndexedChildRecursive("BDay");
    OAMessageStyledTextBean age = (OAMessageStyledTextBean)depTable.findIndexedChildRecursive("Age");
    Date changeBDate = new java.util.Date();
    Date dateToday = new java.util.Date();
    SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
    changeBDate = (Date)dateBirth.getValue(pageContext);
    Calendar cal = Calendar.getInstance();
    ResultSet empAge = null;
    String newAge = null;
    OADBTransaction trans = personam.getOADBTransaction();
    System.out.println("BirthDate: " + changeBDate + " Date Today: " + sdf.format(dateToday));
    String expQuery = "SELECT Trunc((sysdate - To_Date('" + pageContext.getParameter("paramDateBirth") + "'))/365) compAge, Sysdate from dual";
    System.out.println("SQL: " + expQuery);
    PreparedStatement expPreparedStatement = trans.createPreparedStatement(expQuery ,1);
    try
    empAge = expPreparedStatement.executeQuery();
    } catch (SQLException e) {}
    try
    while (empAge.next())
    newAge = empAge.getString("compAge");
    age.setText(pageContext, newAge);
    empAge.close();
    } catch (SQLException e) {}
    regards,
    Jon

  • Pre-selection of rows in 'MULTISELECT'  tableView / DefaultTableViewModel

    Hi all,
    Wondering if anyone has done this before and can help me.
    I have a tableView using the 'MULTISELECT' selectionMode which neatly renders checkboxes against each row allowing them to be selected and deselected; which is fine.
    I need to pre-select some rows before the JSP is rendered. Is there anything I can do in the model that will influence the required rows as being selected ?
    Cheers
    Phil

    Thanks for replying. Yes your right this would select specific rows of a tableView; but only once the tableView has been rendered.
    I need to have some rows checked before the JSP is rendered, so the first thing the user sees when the iView loads is a table with a couple of rows already selected.
    Can't believe this is so hard. Was hoping for a 'column.setRowSelected' method or something I could call while created the model.
    Now looking down the TableViewCellRenderer avenue. So forget the MULTISELECT on the tableview, and hopefully just create a column of checkboxes which I have control over.
    Phil

  • Easy Question:Select many rows from a table and execute BAPI for these rows

    Hi Experts,
    I have created one WD project. The WD project fetches some records of backend using BAPI and displays in a table. I have to select some rows from the table and then execute BAPI for selected rows.
    How I can select multiple records from the table and then execute another BAPI for selected rows.
    Regards,
    Gary

    Hi,
    In the Node which you binded to the table create one more attribute of type boolean.
    For example your node is as below:
    //Table Node
    TableNode
    > Att1
    > Att2
    > isSelected(boolean) - Newly created attribute for this requirement.
    //Result Node contains the elements selected in TableNode
    ResultNode
    >Att1
    >Att2
    Now in the table create one more Column with Checkbox as tablecell editor. Now bind this boolean attribute to that check box.
    Now in the code you can get the selected rows by user as below:
    for(int i=0;i<TableNode().size();i++)
      if(wdContext.nodeTableNode().getTableNodeElementAt(i).getIsSelected()==true)
        IPrivateTestView.IResultNode element=wdContext.createResultNodeElement();
        element.setAtt1(wdContext.nodeTableNode().getTableNodeElementAt(i).getAtt1());
        element.setAtt2(wdContext.nodeTableNode().getTableNodeElementAt(i).getAtt2());
       wdContext.nodeResultNode().addElement(element);
    Regards,
    Charan

  • Selecting multiple rows from List-component

    Hi
    Could someone give me an example how to programmatically select multiple rows from List-component?
    I know that this selects one row: lst_example.selectedIndex = 1;
    But how about selectin indexes 1,2 and 4 for example?

    selectedIndices
    A Vector of ints representing the indices of the currently selected item or
    items...
    var si:Vector.<int> = new Vector.<int>;
    si.push(1);
    si.push(2);
    si.push(4);
    list.selectedIndices = si;

  • Random selection of rows from a 2D array then subset both the rows that were selected and those that were not. Please see message below.

    For example, I have a 2D array with 46 rows and 400 columns. I would like to randomly select 46 data rows from the 2D array. By doing the random selection it means that not all individual 46 rows will be selected some rows may appear more than once as there may be some duplicates or triplicates in the random selection. The importan thing is that we will have randomly selected 46 rows of data (no matter that some rows appear more than once). Then I would like to subset these randomly selected 46 data rows (some which will be duplicated, or triplicated, etc.) and then also find and subset the rows that were not selected. Does this make sense? Then i would like to do this say 10 times for this data set. So that then I will have 2 by 10 data sets: the first 10 each with 46 rows and the other 10 with n rows depending on how many WERE NOT randomly selected. i hope that my explanation is clear. I am relatively new to Labview. It is really great so I am getting better! If anyone can help me with this problems it will be great. RVR

    Start by generating randon #s between 0 and 45. Run a for loop X times and in it use the random function, multiply the result by X and round down (-infinity). You can make this into a subVI, which you can reuse later. In the same loop, or in a different one, use Index Array to extract the rows which were selected (wiring the result out of the loop with auto indexing causes it to be rebuilt into a 2D array).
    One possible solution for the second part would be to go over the array of randomly generated numbers in a for loop and use Search 1D Array to find each of the numbers (i). If you get -1, it means the row wasn't selected and you can extract it.
    I hope this puts you on the right path. If not, don't be afraid to ask more.
    To learn more about LV, I suggest you read the LabVIEW user manual. Also, try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
    In addition, I suggest you read the LabVIEW style guide.
    Try to take over the world!

  • How can I programmatically select row to edit in ADF - 11g

    Hello,
    I'm having a table with rowSelection="single" and editingMode="clickToEdit". Currently i'm facing two issues.
    First issue: the first click on a table row makes the row selected, on second click it becomes editable. If I click on another row it gets selected, but previously selected row remains editable. I would like to change this, so when I select another row, the previously selected one to become read-only again. By now, I didn't find any solution to set programmatically the 'editable' state of a row.
    The second issue might be a bug and is related to deleting an editable row. I select a row, click to edit it, and then delete it. The next row get's selected, but clicking on it to edit, has no effect unless I press the 'ESC' select another row before. Does anyone have a tip how to workaround it?
    Thank you very much!
    Eniko

    try adding this method in the table selectionListener.
    public void table1_selectionListener(SelectionEvent selectionEvent) {
        public String getCurrentRow() {
            BindingContainer bindings = getBindingsForDCB();
            RichTable table=table1; 
            DCIteratorBinding outListIter = getBindingsForDCB().findIteratorBinding("outlistOutIterator");
            RowKeySet rowSet = table.getSelectedRowKeys();
            Iterator rowKeySetIter = rowSet.iterator();
            while (rowKeySetIter.hasNext()) {
                    List l = (List) rowKeySetIter.next();
                    Key key = (Key)l.get(0);
                    outListIter.setCurrentRowWithKey(key.toStringFormat(true));   
                    Row r = outListIter.getCurrentRow();
            return null;
        }

  • If I add artwork by dragging a jpg to the artwork area after selecting several rows, in some instances a single icon is created in the flipper;  in others one is created for each song. Why? How can I get one image per album every time?

    If I add artwork by dragging a jpg to the artwork area after selecting several rows, in some instances a single icon is created in the flipper;  in others one is created for each song. Why? How can I get one image per album every time?

    If I add artwork by dragging a jpg to the artwork area after selecting several rows, in some instances a single icon is created in the flipper;  in others one is created for each song. Why? How can I get one image per album every time?

  • Programmatically selecting row in af:table

    I have an instance of the <af:table> component that points to a value on a managed bean of type List<MyValueType>.
    I need to make the <af:table> have a preselected row, and I have the value of type MyValueType that represents the row I need selected.
    How do I programmatically select the appropriate row in the table?
    Thanks!

    Hi Rune,
    1) Expose the adf table to a managed bean property by using @binding attribute, say, requestScope. The property should be RichTable type.
    2) Create a method in java class which can find the managed bean created in step 1) by using EL expression and calling its RichTable.setRowKey(int) to set the current row. Other row currency method are also available besides setRowIndex(int).
    3) Create Data Control on the java class you created in step 2)
    4) Insert the method created in step 2) into <bindings> as methodAction in page definition file.
    5) Still in page definition file, insert an invokeAction into <executables> to invoke the method action created in step 4)
    6) Reorder the invokeAction created in step 5), place it below the table's <iterator>
    7) Set the @refresh attribute for the table <iterator> and <invokeAction> if you want, for example: "prepareModel"
    -Or-
    You can implement a custom page lifecycle to achieve the goal.
    Todd

Maybe you are looking for

  • HP 7780 All in One Printer will not print PDF files!!!

    I have an HP 7780 All in One printer setup as a network printer.  It will copy, scan, and print everything except PDF files.  Why will it not print PDF files?  You send a PDF file to print.  The printer spins up like its about to start printing and t

  • Fx 5200 Td64

    Hello! When i install the newest drivers , then in windows ( win xp sp1 )  it fozes afer a cuple minutes and the screen becomes black like there is no signal. Then after a about 20 seconds it comes back and there is windows error that windows has jus

  • Problem with SE51 Transaction Code

    Hi, When iam working with tcode se51 screen painter iam getting the error message as EU_SCRP_WIN32:timeout during allocate/ CPIC-CALL:'ThSAPCMRCV'#, But when iam working with my client systems everything is fine. Can anyone help me in the above issue

  • IPhone 4S - iMessage & FaceTime not working.

    My FaceTime and iMessages are not working. (iMessages show as "Not Delivered" and will not receive messages either.) Regular texts work fine though. FaceTime loads for ~ 1 second and D/Cs. I'm on the iPhone 4S (White). Verizon. I have done many thing

  • Movie clip not playing

    i create some animation. actuvally i move mouse on button some menu visible, i click test button  when play "boxani" Movie Clip. but not playing.  ????? Test link http://megaswf.com/serve/1185333 btn_mc.menu_mc._visible = false; boxani_mc.stop(); btn