Select specific row after a refresh

I can not find this in the documentation. I have a table
which list all my records from an XML. I then have a detail region
that allows me to update the data in the CURRENT record. Upon
submitting the updated data to the server, I need the record list
refreshed, not a problem, and then the row previously selected to
be selected again as current row. I have a Unique ID that my
database assigns the records, but that will be different than what
SPRY assigns. What is my best solution? I hope I have not
miscommunicated this.
Thanks,
Lee

This sounds like something that should be added to the data
set api to help folks out. I've jotted it down. Until then, you can
use something like this:
function FindRowIDOfFirstMatch(ds, columnName, value)
if (!ds || !columnName)
return -1;
var rows = ds.getData();
var len = rows.length;
for (var i = 0; i < len; i++)
if (rows
[columnName] == value)
return rows["ds_RowID"];
return -1;
And call it like this:
dsMyDataSet.setCurrentRow(FindRowIDOfFirstMatch(dsMyDataSet,
'@id', '12345678'));
Of course if there is the possibility that it might not find
a row, then you would have to check for a -1 before calling
setCurrentRow.
For a data set observer example, look at this sample file in
the zip file:
Spry_P1_1_06-08/samples/SetCurrentRowSample.html
--== Kin ==--

Similar Messages

  • How can I select the row after a cfgrid refresh?

    I have a form that is bound to a cfgrid.  The grid is populated from a database.  When you navigate in the grid the data displayed in the form changes to match the selected row.  I can edit the data in the form and update the database.  After updating the data I refresh the cfgrid, which then displays the updated data.
    Unfortunately the cfgrid always highlights the first row, row 0, after a refresh.  I want to highlight the same row that was highlighted when the data was edited and saved.  Can anyone advise as to how I can do that?
    I have tried setting a listener when the grid is initiated that responds whenever the store is refreshed and triggers the function refreshSelection():
    g.getStore().on('load', refreshSelection) ;
    Before the form data is saved, the row number is stored in selectedRow[0].  When the grid is refreshed, refreshSelection is run:
    function refreshSelection() {
    if (0 >= selectedRecords.length)
         return;
    alert('Selected row is Row ' + selectedRecords[0] ) ;
    g.getSelectionModel().selectRow(selectedRecords[0]) ;
    selectedRecords[0] = 0 ;
    The alert shows the correct row number each time, but highlighting the last row viewed works intermittently, and only if the alert line is active.  If I comment out the alert, this fails every time, with row 0 being highlighted.  selectedRecords[0] is reset to 0 after the attempt to select the row so that navigation through the grid, such as choosing "Next Page," will properly highlight the first row of the page rather than the last row number that was edited.
    -Rick

    Massage?
    Why not ask the masseuse who gave you the massage?

  • How to select specific rows in rtf template for complex calculation

    Hi,
    I want custom calculation in my rtf template and for this i need to select specific cell's value OR specific row's value. Any one please suggest how can I get this. Below is the example i have plotted using excel. My target is to get field 8 and 9 using sum and minus. We can calculate column over column, is there any way to calculate row over row? If I use variables, then i have to create so many variables because I have more columns and rows to calculate (here i posted one sample table). Any one please help me how can I get expected result other than using variables! If "Using variables" is the only way then also give your valuable opinions.
    Row No
    Curr Qtr
    PQtr1
    PQtr2
    3
    B3
    C3
    D3
    4
    B4
    C4
    D4
    5
    B5
    C5
    D5
    6
    B6
    C6
    D6
    7
    B7
    C7
    D7
    8
    B8=SUM(B4:B7)
    C8=SUM(C4:C7)
    D8=SUM(D4:D7)
    9
    B9=B8-B5
    C9=C8-C5
    D9=D8-D5
    Thanks.

    Hi AlexAnd,
    Thanks for the reply, I got 0 using both codes. This is a dummy table and I plotted 3,4 to give an idea of row number (as like as excel). Rows are individual data sets combining different measures and dimensions with different values.
    Account
    Curr_Qtr
    PQtr1
    PQtr2
    Deposit
    10
    15
    20
    Loan
    15
    20
    25
    Earning
    20
    25
    30
    Assets
    25
    30
    35
    Total
    =SUM(15,20)
    =SUM(20,25)
    =SUM(25,30)
    Expense
    =SUM(15,20)-25
    =SUM(20,25-30
    =SUM(15,20)-25
    Is there any way to identify the range or individual cell's value? Using variables I have to create lots of variables for each cells, I want to avoid that and want to use rows in calculation! Is that possible, Pls share your valuable opinions!
    Thanks.

  • Select specific row

    Dear all,
    I have a table containing 50 rows and I would like to select only rows between 20 and 30. Can you help me to do this with only one select statement or whatever you suggest. Also is it possible to do it without using rownum
    Thanks
    SL

    I do want want any specific criteriaSo in fact you should have called this thread Select unspecific rows, hmmm?
    If you're really not bothered about the precise number of rows then the SAMPLE cause is a very performant way of getting a random subset of rows...
    SQL> SET TIMING ON
    SQL> SELECT count(*) FROM big_t
      2  /
      COUNT(*)
         31764
    Elapsed: 00:00:01.04
    SQL> SELECT count(*) FROM
      2  ( SELECT *  FROM big_t SAMPLE (0.1) )
      3  /
      COUNT(*)
            33
    Elapsed: 00:00:00.03
    SQL> SELECT count(*) FROM
      2  ( SELECT *  FROM big_t SAMPLE (0.1) )
      3  /
      COUNT(*)
            32
    Elapsed: 00:00:00.01
    SQL> Cheers, APC

  • Selecting top row after sorting

    hi,
    i have a table emp, whose primary key is empid(varchar2),
    i want to sort the empid and select the top row after sorting,
    i can sort the table using "select * from emp order by empid desc,
    i can select the top row using "select * from emp where rownum=1"
    i want a combination of the 2,
    pls provide me the required query
    Thanks and Regards,
    Saurabh Jhunjhunwala

    SEELCT *
       FROM ( SELECT e.*
                               , ROWNUM  row_num
                       FROM emp e
                     ORDER BY empid desc
    WHERE row_num =  1Regards
    Arun

  • Dis-Select table rows after table update.

    Hello All,
    I have given the user a functionality to update table records on the BSP page.
    I am using multiselect first and then when user clicks on a button, the selected rows becomes editable...
    The user can then edit the rows and after they click on another button, the changes gets reflected in the database table....
    Now my problem is that when the table is updated, i am changing the selectionMode to Multiselect, but the rows still remains selected and i want to clear all the selected rows...i.e <b>dis-select all the rows...</b>
    Please help.
    I am using an iterator..

    Here you go..
    cl_htmlb_manager=>check_tableview_all_rows( rowcount = n
    request = request
    id = '<tableview id>'
    keytable = keytable "Table containing the key values of your itab
    check = '' ). "If its 'X' all items will be selected and ' ' will uncheck all items.
    <i>* Reward each useful answer</i>
    Raja T

  • How to select Specific string after a character

    Hi,
    while creating a user account in discription bar we have the ticket number - Name of owner = managers email id. This format is shown as ex in discription tab of user properties.
    INC000233 - Alex B = [email protected]
    How can i collect string after character "=" i.e
    [email protected]? i tried to use the select string cmdlet but it gives the complete string.
    Please suggest.

    Hi Tommy,
    Thanks it really works and help me. One last daught. There are few entries which are in given format like
    Description - This generic Id is created for test - Luck_Don@domain .com
    So here it gives me error like
    You cannot call a method on a null-valued expression.
    At line:8 char:33
    + $email = $des.split("=")[1].trim <<<< ()
        + CategoryInfo          : InvalidOperation: (trim:String) [], RuntimeExcep
       tion
        + FullyQualifiedErrorId : InvokeMethodOnNull
    I think, this error is popped up becasue " sign is not present at the end of email id. Any idea how to solve this.

  • Selecting a row after dataset has loaded

    I have a situatioin where my server side logic supplies logic
    to provide a possition in the XML to be selected.
    EG:
    <script>
    var dsImages = new
    Spry.Data.XMLDataSet("/gallery.xml","/images/image");
    </script>
    and the server supplys a variable to say that "image 12 is
    selected"
    inline doesn't work as I guess the Javascript is firing
    before the dataset is loaded:
    EG:
    <script>
    var dsImages = new
    Spry.Data.XMLDataSet("/gallery.xml","/images/image");
    dsImages.setCurrentRow(12);
    </script>
    so I want to be able to fire a callback(?) function once the
    dataset is loaded
    Is this possible? or is there another solution do achive this
    someone know of?

    I found the answer in the previous post to this. (
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=72&catid=602&threadid =1251912&enterthread=y)
    Observers!

  • Select ALV row right after first display

    Hi,
    I want to pre-select specific rows in my ALV already when it`s first displayed. I tried to use method set_selected_rows in the PBO where the ALV object is created, but it did not work. It only worked when I put the method in the PAI.
    Can I select rows of the ALV when it is initially displayed, that is before it`s screen`s PAI is called?
    Thanks.
    Krisz

    Hi
    Its possible to have the rows pre-selected using buttons.
    In PBO, after calling method-set_table_for_first_display
         CALL METHOD cl_grid->get_selected_rows
           IMPORTING
             et_index_rows = tb_row_id[]
    Loop on the internal table whose records are displayed in ALV,
    and set the parameter index in TB_ROW_ID as SY_TABIX.
    endloop.
         CALL METHOD cl_grid->set_selected_rows
           EXPORTING
             it_index_rows = tb_row_id.
    I have tested it and works.
    Please let me know whether it works or not
    BR
    Lavanya

  • Show the checkbox as selected by selecting the row.

    Hi friends,
    I have a table. It is possible to select multiple rows, after selecting rows, I get the selected
    rows in this table from the context. Now my question is, how can i cause that by selecting a row
    the checkbox on this row will be also selected (shown as checked)?
    So this is the coding in the eventhandlermethod on onselect property of the table:
    METHOD onactionmark_cb .
      DATA lo_nd_table_data TYPE REF TO if_wd_context_node.
      DATA lo_el_table_data TYPE REF TO if_wd_context_element.
      DATA ls_table_data TYPE wd_this->element_table_data.
      DATA lt_table_data TYPE wd_this->elements_table_data.
      DATA lt_set TYPE wdr_context_element_set.
    DATA lv_idx TYPE i.
    navigate from <CONTEXT> to <TABLE_DATA> via lead selection
      lo_nd_table_data = wd_context->get_child_node( name = wd_this->wdctx_table_data ).
    This would now contain the references of all the selected rows
      CALL METHOD lo_nd_table_data->get_selected_elements
        RECEIVING
          set = lt_set.
      LOOP AT lt_set INTO lo_el_table_data.
        " Use the references to get the exact row data
        CALL METHOD lo_el_table_data->get_static_attributes
          IMPORTING
            static_attributes = ls_table_data.
        APPEND ls_table_data TO lt_table_data.
        CLEAR ls_table_data.
      ENDLOOP.
    mark/shhow the checkboxes checkd in the selected rows
    ENDMETHOD.
    Thank you for any help
    Haleh
    Edited by: Haleh Mir Ashrafi on Nov 9, 2008 6:29 PM

    Hi Haleh,
    I tried replicating your requirement and have written below the exact working code for the same. I will try to explain you my component so that you can get to understand its functionality. I have 2 tables & 1 input field in my view. The user enters a customer number in the input field and presses on a button. This leads to the corresponding sales orders filled into the 1st table ui element. The user then selects multiple rows from this table and presses on a toolbar button to copy these selected rows to the 2nd table. Within the same event I also set the checkbox for the rows selected by the user in the 1st tables row to selected. Hope that this would meet your requirement. On pressing the button the system would check if the checkbox is enabled & then mark the selected rows checkboxes as selected and would also copy the rows to the 2nd table. If the checkbox is disabled then the system would neither set it as checked nor copy it to the 2nd table. The rest of the checkboxes for the rows which weren't selected by the user remain as unchecked.
    METHOD onactioncopy_selected_rows .
      DATA:  wd_node TYPE REF TO if_wd_context_node,
             ls_node1 TYPE ig_componentcontroller=>element_node1,
             lt_node1 TYPE ig_componentcontroller=>elements_node1,
             wa_temp  TYPE REF TO if_wd_context_element,
             lt_temp  TYPE wdr_context_element_set.
      wd_node = wd_context->get_child_node( name = 'NODE1' ).
      " Get all the context element information for the rows selected by the user
      CALL METHOD wd_node->get_selected_elements
        RECEIVING
          set = lt_temp.
      " Just get the reference of the 2nd table to which you want to copy selected rows
      wd_node = wd_context->get_child_node( name = 'NODE2' ).
      LOOP AT lt_temp INTO wa_temp.
        CALL METHOD wa_temp->get_static_attributes
          IMPORTING
            static_attributes = ls_node1.
        " Check if the checkbox is disabled/enabled. The "enabled" property of the checkbox
        " is bound to the boolean context attribute by name ENABLED
        IF ls_node1-enabled EQ abap_true.
          wa_temp->set_attribute( EXPORTING name  = 'CHECKBOX'
                                            value = abap_true ).
          APPEND ls_node1 TO lt_node1.
          CLEAR ls_node1.
        ENDIF.
      ENDLOOP.
      " Bind the rows selected by the user to the 2nd table ui element
      wd_node->bind_table( new_items = lt_node1 ).
    ENDMETHOD.
    I have checked your code where you say like:
    IF elem_test->is_selected( ) = abap_true AND stru_test-enabled = abap_false.
    You had earlier fetched the entire elements list using the get_elements method of if_wd_context_node & then checking each 1 of them individually to determine whether it was selected or not using the method id_selected. You can directly get only the elements which were selected by the user by using the method get_selected_elements instead. So now you will only have to check whether the checkbox field in that particular row is disabled/enabled. You now don't have to combine 2 conditions using AND & check them within the loop.
    Regards,
    Uday

  • 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

  • Returning specific rows within a resultset.

    I have a table with the following rows:
    Category Site Title
    ======== ==== ======
    1 1 sometitle
    123 1 sometitle
    128 1 sometitle
    4 1 sometitle
    10 1 sometitle
    I have a REF cursor that looks like this:
    OPEN RefCursor FOR
    SELECT Category, Site, Title
    FROM TableName
    WHERE Site = 1
    ORDER BY Category;
    Now...Here is the catch. In that same select statement, I want to be able to retrieve a specific range of rows to return, once the 'order by' is done.
    I want to be able to execute my query, having it return rows 2 to 4...
    So my RefCursor should contain:
    Category Site Title
    ======== ==== ======
    4 1 sometitle
    10 1 sometitle
    123 1 sometitle
    The two important things are this:
    1- The initial resultset must be sorted first..THEN I want to select specific rows.
    2- The final result set MUST be a Ref Cursor.
    Anyone have suggestions?

    This will retrieve ordered rows 2 -4.
    (SELECT Category, Site, Title
    FROM
    (select category, site, title
    from tablename
    order by category)
    WHERE Rownum < 5)
    MINUS
    (SELECT Category, Site, Title
    FROM
    (select category, site, title
    from tablename
    order by category)
    WHERE Rownum < 2)
    /

  • After SALV Refresh, rows are still selected in display

    I have an SALV output (simple list) that updates  a database table based upon user action.  During the user_command processing, I modify the internal table for the SALV, removing the rows that have been updated by the user, and clearing my index row table created from the get selects methods (this appears to prevent this problem in older ALV versions).  Then, I do a alv->refresh( ).
    Upon re-entry to the SALV display, all the data is correct, but the rows that were previously selected by the user are highlighted.  For example, if the user updated row 1, I do the processing and return to the SALV display after refresh. Row 1 (formerly row 2)  is now highlighted.
    If the user updated rows 1 and 3, upon return to the screen 1 and 3 are still selected (were 2 and 4 before the update).   .  If the user updated the last row, the SALV display has no rows highlighted and cursor is on row 1, column 1, which would seem to be the correct behavior after the refresh.
    SALV_DEMO* programs don't appear to handle this, and I don't find any method that will let me reset that prior user selection.
    Any suggestions to correct the "memory" feature of the SALV display?

    Hi ,
    Try to free your container before clearing your alv grid.
    try the below code.
    CALL METHOD containername->free
            EXCEPTIONS
              cntl_error        = 1
              cntl_system_error = 2
              OTHERS            = 3.
          IF sy-subrc <> 0.
          ENDIF.
          CLEAR containername.
          CALL METHOD grid name->free
            EXCEPTIONS
              cntl_error        = 1
              cntl_system_error = 2
              OTHERS            = 3.
          IF sy-subrc <> 0.
          ENDIF.
          CLEAR grid name.
    Regards,
    Chitra

  • How to select all rows in table automatically after refreshing?

    Hi,All
    After refreshing the table,I want to select all rows,like MultipleButton's function.
    How can I do?
    Thanks
    Smile.

    Hi,-Grif-
    * Set the selected state for the given row groups
    * displayed in the table.  This functionality requires
    * the 'selectId' of the tableColumn to be set.
    * @param rowGroupId HTML element id of the tableRowGroup component
    * @param selected Flag indicating whether components should be selected
    function selectGroupRows(rowGroupId, selected) {
      var table = document.getElementById("form1:table1");
      table.selectGroupRows(rowGroupId, selected);
    }I don't know that the parameter selected is a boolean,or the checkbox(radio button) id?
    Thanks
    Smile

  • Programmatically refresh components inside a specific row of an af:table

    How to programmatically refresh components inside a specific row of an af:table without refreshing the whole table ?_
    I have an af:table displaying a read-only view object. There is an edit button inside the table calling an af:popup, where the user can update some informations and click a submit button to validate his changes.
    The action property of this button is a method in a backing been where
    -     1 : A stored procedure is called to update several tables (related to my read-only VO).
    -     2 : The VO is re-queried (VO. refreshQueryKeepingCurrentRow() )
    -     3 : The whole table is refreshed (AdfFacesContext.getCurrentInstance().addPartialTarget(myTable) )
    Is it possible to programmatically refresh some components of the current row of the table without refreshing the whole table (point 3)?
    I’ve tried to play with the “partialTrigger” property of af:outputText (table:column:outputText), without success.
    Thanks
    Nicolas

    "+do you happen to want to refresh following an action on the row? Like a link/button click?+" : NO
    There is a table on my page. The user select a row and click on an edit button. This edit button call a popup where the user can modify some information (not directly on the viewObject. All fields in the popup are dummy fields bind to attributes in my backing bean) and then he click on a submit button.
    The submit button action execute a method "submitInformation" in a backing been.
    public String submitInformation(){
            Map<String, Object> params = new HashMap<String, Object>();
            params.put("pManNo", xManNo.getValue()); //xManNo is an attribute of the backing bean
            params.put("pDate", xPeriod.getValue()); //xPeriod is an attribute of the backing bean
            // Execute Operation
            OperationBinding oper = ADFUtils.findOperation("serviceSubmitInfo");
            oper.getParamsMap().putAll(params);
            String results = (String)oper.execute();
            // Close Popup & Refresh Row if OK
            if(!StringUtils.isStringEmpty(results) && results.equals("TRUE")){
                 closePopup("pt1:popAbs");
                 refreshMyCol();
    }The serviceSubmitInfo method is defined in my serviceImpl
        public String serviceSubmitInfo (String pManNo, String pPeriod, ......){
             String results =
                callStoredFunction("? :=myDatabaseFunction(?, ?, ?, ?)",
                                   new Object[] { pManNo, pPeriod, ...... });
              // Commit
              getDBTransaction().commit();
              // Refresh VO (re-query & set currentRow)
              getMyVO().refreshQueryKeepingCurrentRow();         
              return results; // TRUE if ok
        }I want the " refreshMyCol()" method to refresh only the current row and not the whole table...
    Regards
    Nicolas

Maybe you are looking for

  • Troubleshooting InTune, SCCM, and Windows 8.1 Phones

    Howdy... I've setup various components but when I use my Windows 8.1 Samsung phone "Workplace Account" feature, the phone gets stuck on "We're looking for your settings...", it will stay on this for 15+mins if I let it. What can I do for further trou

  • Video podcasts no longer sync with iPod Touch

    I am using latest version of iTunes 10.1.1 (4) and latest os 10.6.5 on MacBook Pro with iPod Touch (gen 3). I subscribe to a video podcast and in beginning it worked, but for last 2 months though they download into iTunes and I can watch them, they a

  • ARTISTS SECTION OF IPOD

    When I go to 'Artists' in the section that has Playlists, Artists, Albums, Songs etc. instead of having all my different artists listed alphabetically I have all the songs from my ipod listed alphabetically like in the 'Songs' section. I hope that ma

  • I've got Contact lists in my Yahoo Mail but can only access individuals via my IPad. Why is this ?

    I've got Contact Lists in my Yahoo Mail but cannot access them (as Groups) via my IPad. Why is this ?

  • MacBook Pro reset clock with lost idisk data files

    Hi, I opened my MacBook pro this morning but it had reset the clock back to Jan 01, 2001 and had also lost all wireless passwords. This I have manually updated again which is fine but my iDisk on mobile me has reset itself to November 2010 meaning I