Previous Values of Selected Items in a Datagrid

I have a datagrid which the dataprovider is bound to an ArrayCollection of Value Objects from a web service.
One other thing which is important to point out.   The Value Objects are created automatically for the Data/Service and so if I change the files, they will just be overwritten the next time I make a change to the service.
The grid displays Inventory Items.    Lets say that Item 1 has a qty of 20.   Item 5 has a Qty of 10.
The list in this grid is based upon the selection of a Location tree.   So it lists the inventory items for a certain location.
I also have a second tree and grid for the to location inventory items.
Between the two grids, there is a button which when clicked it iterates thru the selected items and creates a new item in the to list with qty 1 and saves it.  then decreases the current qty in the from list by one.
So lets say I selected items 1 and 5 and then clicked the button.   A new copy of Items 1 and 5 are created in the to list with a qty of 1 and then saved.   Then the qty in the from list is decreased by 1 and saved and so the vales for 1 is now 19 and for 5 is 9.
I would like to be able to change the qty in the from list to the qty I want to move.   So when the button is clicked the new item in the to list reflects the new qty and is saved.   Then the previous value of the current qty is decreased by the qty which is displayed in the grid
So lets say I changed item 1 to 2 and Item 5 to 3 and then selected items 1 and 5 and then clicked the button.   A new copy of Items 1 and 5 are created in the to list with a qty of 2 for item 1 and 3 for item 5 and then saved.   Then the qty in the from list is decreased for Item 1 by 2 and item 5 by 3 and so now Item 1s qty is now 18 and items 5 qty is now 7.
My first thought was if I had the previous values stored then no big deal.  But I put a break point at the point where the SelectedItems list is being iterated through and the previous values are not stored anywhere. 
Any suggestions for this?

...in the mean time, this should be enough
win.pnl.list1.onChange = function() {
     alert(this.selection.index); // for this to work set, multiselect:false
I guess you already tried and the result is "undefined", the reason is you have this property
multiselect:true
in that case, selection returns an array,
this.selection[0].index;
would give you the first selected item, even if you only have one item selected, to get all selected items loop thru all items in the selection array.
not sure if Peter's wonderful guide explains this (it is explained in the Tools Guide), but you should read it too, it has tons of great info.

Similar Messages

  • Using value of selected item list

    I'm working on existing code. I want to use the value of a selected item in a list to use it in a query. So, the corresponding records should be displayed in a subform when an item of the list is selected. This is the code i'm using:
    This is the code i use to populate the list
    DECLARE
    locatienaam varchar(100);
    locid number;
    recordcount number;
    i number;
    correct NUMBER;
    hList ITEM := Find_Item('LIST_LOCATIE');
    iRC PLS_INTEGER := 0;
    currValue VARCHAR2(60); /* increase if required*/
    BEGIN
    --vraag het bijhorende ID op van de geselecteerde locatie.
    currValue := Name_In('LIST_LOCATIE');
    FOR i IN 1..Get_List_Element_Count(hList) LOOP
    IF currValue = Get_List_Element_Value(hList,i) THEN
    iRC := i;
    break;
    END IF;
    END LOOP;
    locid := GET_LIST_ELEMENT_VALUE('LIST_LOCATIE', iRC);
    locatienaam := GET_LIST_ELEMENT_LABEL('LIST_LOCATIE', iRC);
    Below the code i use to make the query
    SET_BLOCK_PROPERTY('V_KALENDER',DEFAULT_WHERE,'(BEGINDATUM BETWEEN '||''''||:V_KALENDER.TIJDSTIP1 ||'''AND '||''''||:V_KALENDER.TIJDSTIP2||''') AND (NAAM=:locatienaam)');
    GO_BLOCK('V_KALENDER');
    Execute_Query;
    I get the message: "unable to resolve reference to locatienaam"
    The subform is populated with all the records between the two dates of all the locations, not only by the selected location.

    Hi,
    Welcome to the forum!
    If locatienaam is a local variable, don't use a colon (:) to reference it.
    You didn't say
    IF :currValue = Get_List_Element_Value(:hList,:i) THEN so why should you say
    :locatienaam?

  • Check Value of Selected Item

    I select an item from table, what syntax do i have to use to know if the last digit of the value i selected is equal to 6 to 9?and how can i append value from that selected item

    Hi,
    u can use like this....
    SELECT *
                 FROM <dbtab>
                 INTO TABLE itab
                 WHERE <fldname> LIKE '%6'
                 OR <fldname> LIKE '%7'
                 OR <fldname> LIKE '%8'
                 OR <fldname> LIKE '%9'
    and for the Appending part..
    SELECT *
                 FROM <dbtab>
                 APPENDING TABLE itab
                 WHERE <fldname> LIKE '%6'
                 OR <fldname> LIKE '%7'
                 OR <fldname> LIKE '%8'
                 OR <fldname> LIKE '%9'
    Edited by: Sukriti Saha on Oct 24, 2008 9:25 AM

  • Retrieving value of selected item in sap.m.list

    var data = {
                    details :   [{             
                 Name : "MuthuKannan",  Age : "22",Location :"Bangalore" },
              {  Name : "Sachin Tendulkar",  Age : "35", Location :"Mumbai"  },
    var model = new sap.ui.model.json.JSONModel();
    model.setData(data);
    var model1 = new sap.ui.model.json.JSONModel(); 
    model1.setData({ 
             col1 : "Name ", 
             col2 : "Age", 
             col3  : "Location "
    sap.ui.getCore().setModel(model1, "mkModel1");
    list = new sap.m.List("", { 
                  threshold: 2,
                  inset : false, 
                  select :  function(){
             a = list.getSelectedItems();
                 alert(a[0].getBindingContext());
    How can I get the name of selected item? I tried the highlighted text but I am unable to proceed ,I even tried toString() function still I am not getting the output.All I am getting(alert box)  is either "null" or "undefined". Kindly help me on this.
    Thanks and Regards,
    Muthu Kannan S

    Try this
    list = new sap.m.List("", {
                  threshold: 2,
                  inset : false,
                  select :  function(oEvent){
                     // oEvent is the key to access everything
                     oEvent.getSource().getSelectedItem() ;

  • How to get the display value of selected item in list box?

    I have a page with an HtmlSelectOneListbox that is filled with an ArrayList of SelectItem objects.
    The SelectItem objects contain a Key and Value. The Value is displayed in the ListBox.
    The value parameter of the listbox is bound to a bean property which is called selectedListItem.
    The bean property selectedListItem contains the Key of the SelectItem that is selected.
    How do I obtain the Value of the selectedListItem?
    I need to be able to get the Value field that is displayed, not just the Key to the item that is displayed.
    Edited by: burferd on Nov 3, 2007 10:03 PM

    How are you filling in the value of the menu? Obtain it back by the same way. Or pass it along the key in a object.
    This article may give useful insights: http://balusc.blogspot.com/2007/09/objects-in-hselectonemenu.html

  • Keep previous values for Select-Options

    I am using macros to populate my selections with the previously entered values.  Everything works fine until I want to delete the previous selections for so_snp via the Trash Can button.  The selections come back.  The issue seems to be that the selections are deleted from the so_snp range but then the AT SELECTION-SCREEN OUTPUT executes makro_get_range which re-populates the so_snp selection from the data stored in the buffer because so_snp is initial.  How do I get the AT SELECTION-SCREEN code to execute first so that the makro_set_range can clear out the shared buffer for '/SAPAPO/PT_PLAN_SNP'.  I have included excerpts from my ABAP program.
    Any help would be appreciated.  I struggled with this all day long.
    Best regards,
    Sandy
    DEFINE makro_get_range.
    initialization
      clear:
        lv_line,
        lv_key.
    import SET/GET-parameter from shared buffer
      if &2[] is initial.
        concatenate sy-uname  &1 '_T' into lv_key.          
        import &2[] from shared buffer indx(st) id lv_key.
        if sy-subrc eq 0.
          read table &2 index 1.
        endif.
      endif.
      if &2 is initial.
        get parameter id &1 field &2.
        if sy-subrc ne 0 and &2 is initial.
          refresh &2[].
        endif.
        if not &2   is initial
           and &2[] is initial.
          append &2.
        endif.
      endif.
    END-OF-DEFINITION.
    DEFINE makro_set_range.
    initialization
      clear:
        lv_line,
        lv_key.
      concatenate sy-uname &1 '_T' into lv_key.
    export SET/GET-parameter to shared buffer
      describe table &2[] lines lv_line.
      if lv_line gt 1.
        export &2[] to shared buffer indx(st) id lv_key.
      else.
        delete from shared buffer indx(st) id lv_key.
        set parameter id &1 field &2.
      endif.
    END-OF-DEFINITION.
    SELECT-OPTIONS so_snp FOR /sapapo/matloc-planner_snp.
    AT SELECTION-SCREEN OUTPUT.
       makro_get_range '/SAPAPO/PT_PLAN_SNP'    so_snp.
    AT SELECTION-SCREEN.
        makro_set_range '/SAPAPO/PT_PLAN_SNP'    so_snp.

    Can you set a flag to indicate that it needs to be done only once like below?
    AT SELECTION-SCREEN OUTPUT.
    IF v_flag_get_done_once IS INITIAL.
    *-- get the values from the shared buffer
      makro_get_range '/SAPAPO/PT_PLAN_SNP' so_snp.
      v_flag_get_done_once = 'X'.
    ELSE.
    *-- user manipulated the selection screen values, so
    *   don't do it again. Do Nothing.
    ENDIF.
    Srinivas

  • How to acquire display value of selected item on select list? Or...

    I have a select list generated from a SQL query that I need to get the display value from.
    Ideally, the display value and the submitted value of the select list would have been the same, but I can't seem to get APEX to allow populating a select list's display value and submitted value fields with the same database column.
    If you have any idea how to do either of the above, I'd love to hear from you here!
    Cheers,
    Ben

    you forgot the extra quotes I guess:
    declare
    l_sql VARCHAR2(4000);
    begin
    l_sql := 'SELECT product_name,project_name,information_access_system,dataset_name FROM v_dms_product WHERE product_name = ''' || :P24_CHOOSEPRODUCT || ''' GROUP BY product_name,project_name,information_access_system,dataset_name';
    return l_sql;
    end;

  • Change the font style in a selected item on a DataGrid

    Hi!!
    I have a normal DataGrid and i want to set the font to BOLD style the selected row.

    try it:
    ...datagrid id='dg'....
    <mx:DataGridColumn
         width="50" sortable="false"
         headerText="My Title"
         textAlign="center">
         <mx:itemRenderer>
              <mx:Component>
                   <mx:Text fontWeight="{data == dg.selectedItem?'bold':'normal'}"
                                       text="{data.title}"/>
              </mx:Component>
         </mx:itemRenderer>
    </mx:DataGridColumn>

  • How to Captured Value into Select-Options Range Table Without "Enter"

    Hi,
    I defined a set of Select-Options in the Web Dynpro. I found that the value for the Select-Options will not be captured whenever I manually type in the value instead of choosing it from F4 Help Drop Down.
    However, this problem can be resolved if I manually type in the value for Select-Options in the Selection Field and I press "Enter". Without pressing "Enter" value will not be captured.
    Any solution for this issue? Please help.

    Hi Kris,
    My problem is only when the user key in the value themselves rather than choosing it from Select-Options drop down value. Most of the time user will know what value to key in and will skip the step to choose from the Drop Down List. Thus, if this happen, the value keyed in by the user will not be able to capture into the range table.
    I am using this logic to capture the value for selection item:
      wd_this->m_helper->get_selection_screen_items(
        IMPORTING et_selection_screen_items = lt_sel_item ).
    * Values From Selection Screen
      LOOP AT lt_sel_item ASSIGNING <fs_sel_item>.
        CASE <fs_sel_item>-m_id.
          WHEN `PERNR`.
            ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_pernr>.
          WHEN `BUKRS`.
            ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_bukrs>.
          WHEN `STAT2`.
            ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_stat2>.
          WHEN `WERKS`.
            ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_werks>.
          WHEN `BTRTL`.
            ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_btrtl>.
          WHEN `PERSG`.
            ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_persg>.
          WHEN `PERSK`.
            ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_persk>.
          WHEN `ABKRS`.
            ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_abkrs>.
          WHEN `BEGDA`.
            ASSIGN <fs_sel_item>-m_value->* TO <fs_begda>.
        ENDCASE.
      ENDLOOP.
    E.g. User key in the BUKRS without using the Drop Down Value provided by the Select-Options. For this case, <fs_bukrs> table will be initial as no value is captured.
    Edited by: Girish Nabar on Apr 21, 2011 8:55 AM

  • How to get Value of a item of first record when current record is second

    How to get Value of a item of first record when current record is second in Form6i ?
    get_item_instance_property dose not allow to get value.

    Gerd,
    You're right, there are several other triggers that must be coded, but I was responding to Steve's statement about Inserting or deleting records from the multi-record block. For the record, I use the following to manage a Record Group:
    * When-New-Block-Instance - Initialize the RG
    * block Post-Query - populate the RG
    * When-Create-Record - add new record to RG
    * When-Remove-Record - remove record from RG
    * block When-New-Item-Instance - capture previous value of the item or row
    * When-Validate-Item - Item specific Insert, Update, Delete of values in the RG
    There are a few other places as well, but these are the minimum. It might seem like a lot of code, but then again, I don't use this solution for every multi-line block. Like all tools, you use the right tool for the job. :-)
    Craig...

  • Selected item getting changed after paging in paged datagrid

    I have a paged datagrid. It contains two drop downs. Once i clicked for pageing, the previously selected item getting changed. Please give me solution to solve this problem.
    Thanks & Regards
    kvpdy

    I put the dropdown in item renderer and the selected item is based on the database value. How can we store that and reapply in paging ?
    Pls give me solution....

  • How to refresh page after selecting value from LOV item , in a tabular form

    Hi ,
    I have a tabular form, which contains 2 items(columns), of type "Select List - named LoV".
    Now, couple of issues here.
    1.
    2nd item(column) in tabular form, that LoV should get populated based user's selection value in first item LoV. So how do i refer to the value, that user selected in first item's LoV? I will have to use this reference in LoV query of my 2nd item ( on this tabular form)
    2.
    How can we refresh the page, when user selectes value in first item ( from LoV). As this is a tabular form, here item type is Select List, we dont have an option to pick item type as Select List with Submit. So problem is that when user selects value for item 1, refresh does not happen and item 2 LoV does not get populated as per user's selection in item 1.
    Please help here. Would be really appreciated.
    Thanks and Regards,
    Rave.

    Thanks Ben and Dan for your responses.
    Ben, your solution helped me with refresh of page, as page got submitted.
    This answers to my 2nd question. However, I still need to know first question, which basically is, how do i refer to the value, that user selected in first item LoV.
    Issue is, I selected the value in first item LoV, it got submitted and page fot refreshed. But after page refresh, first item LoV loses its value that I had selected last time. It does not retain the selected value after refresh.
    I have an unconditional process, that on every submit(refresh) of page, I set my items with their corresponding values. But problem is what do i mention there to refer to this item.
    I looked in view source of my page, this item is referred as f03.
    So i used "apex_application.g_f03", to set this item to its value, in my uncoditional submit process. But it did not work. I tried to refer this item as "f03" in this unconditional submit process. But still it did not help, the selected item loses its value after page refresh(submit).
    Any help here would be really appreciated. Please suggest how do we refer to this item's selected value.
    Thanks and Regards,
    Ravi.

  • Could not find selected item matching value "null" in CoreSelectOneRadio

    Hello,
    I get the following error with my selectOneChoice components:
    WARNING Could not find selected item matching value "null" in CoreSelectOneRadio[UIXEditableFacesBeanImpl, id=dyna_2709976_11]
    It seem that the component looks for a selectItem object qith its value set to null, so I tried to add one with a null value to no avail. The error don't cause any problem on the rendered page but it might spam the log when many users will be connected. Anyone every got this error and found a fix to stop it from appearing?
    Regards,
    Simon Lessard

    you said you're using selectOneChoice but the error says radio. Is the information correct?

  • Could not find selected item matching value "New" warning message in ADF

    Hi,
    I have a selectOneChoice1 for a field which has the following fixed values in it. And while creating it, I selected the 'SelctionRequired' option so that this field will always have a value.
    New
    Pending
    Completed.
    While navigating to this page, I am trying to set the value to 'New' (Retrieved from the DB) in the backing bean. But when the page is rendered, the above field is empty with the above options in the list and jdev has the follwing error message in its log.
    WARNING: Could not find selected item matching value "New" in CoreSelectOneChoice[UIXEditableFacesBeanImpl, id=selectOneChoice1]
    Can any one help me with this issue?
    Thanks,
    Priya

    The value of a list binding is the zero-based integer position in the list that is selected, not the actual underlying value.
    The simplest way to set the value of an attribute is to use an attribute binding (which can be bound to the same attribute as the list binding). When you set the value of an attribute binding, it sets the value as you supply it. Otherwise, you'd need to set the list binding's value to the numerical "slot" number of the one you want to change the value to.

  • How to find the PREVIOUS value of a non-DB item?

    I want to do a simple thing but found it impossible.
    I want to find the previous value of a non-DB item in a form.
    I tried creating a text item and populating it using PRE-TEXT-ITEM but that does not work.
    WHEN-VALIDATE-ITEM does not work either because WVI fires only after item value has changed.
    Any suggestions will be greatly appreciated.
    Edited by: Channa on Apr 2, 2010 4:34 AM

    Channa wrote:
    I want to do a simple thing but found it impossible.
    I want to find the previous value of a non-DB item in a form.
    I tried creating a text item and populating it using PRE-TEXT-ITEM but that does not work.
    WHEN-VALIDATE-ITEM does not work either because WVI fires only after item value has changed.
    Any suggestions will be greatly appreciated.
    Edited by: Channa on Apr 2, 2010 4:34 AMPlease make it clear what is your requirement then possibly we can provide you a better answer
    You can use Global variables for to store old values also on Post-query populate a value in separate field or Parameter

Maybe you are looking for

  • Lost all my music in itunes

    When I opened itunes this morning all my music that I had on the computer is gone! No list, no podcasts, no purchased music, nothing. The other day I did accidentally trash my music folder but I dragged it back out of the trash and itunes still worke

  • When I try to open up a linked pdf, Firefox keeps asking me where I want to save it!!

    Firefox never used to do this. It does it with our Intranet site and on other external sites. I don't want to save the pdf. This is very infuriating and if it is not resolved I will change to another default browser. Also a recent Firefox update to v

  • Using .getXMLString() in JAVA code

    I was trying to experiment in what XML output I would get from a query on a database of mine so in a JAVA program outside the database I tried: OracleXMLQuery oxq = new OracleXMLQuery(conn, query); oxq.setRowsetTag(row set"); oxq.setRowTag("row"); re

  • IE 10: SSRS Reports no longer allows Drop Down functionality

    IE 10 doesn't support the SSRS Report Drop Down Functionality. It works fine with IE 9: The drop down arrow functionality only works with IE9 SSRS server for folders and reports. It does not work with IE 10. Please advise. Garth Henderson - Vanguard

  • Sharing folders with S-users

    Dear Colleagues I evaluate a lot of documents from partners and need to know how can I share a folder with a partner that has s-user and a passport installed. Until today I am facing a lot of problems trying to do that. Thanks, Jorge