Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Need to Set PL/SQL Region Source Dynamically and Refresh Without Submit

728781Mar 18 2010 — edited Mar 19 2010
Please have a look at [my example|http://apex.oracle.com/pls/otn/f?p=49882:3653] . (By the way, how can I make that look like an actual link? The Insert Link button in the forum Post Thread page just adds the link text after the label and wraps the whole thing in brackets.)

I am currently fiddling with it so it may look a bit different for time to time, but...

The "PL/SQL Report Region" with the five report lines is based on an apex_collection. As a user clicks in any one of the "Qty" fields, the "Availability" region appears slightly below the field with the focus. Go ahead, try it. This is done with JavaScript onFocus - no big deal.

I need the content of the Availability region to change based on the "Item Nbr" in the text box to the left of the Qty text box that just got the focus.

This needs to happen without submitting the page.

I can set the value of a page Item and have it change dynamically. In this case, the item labeled "This" is a Display Only item and it changes dynamically to show the index number and the id of the Qty item just focused.

The green box labeled "Excerpt from the availability Report Query:" only shows the query. The source of the Availability region should actually be something like:
declare

  l_row_color                varchar2(7);
  l_divider_color            varchar2(7);
  l_detail_row_switch        number       := -1;

  cursor cur_availability is

    select si.site
         , nvl(si.qty_available, 0)   available
         , nvl(si.qty_on_hand, 0)     on_hand
      from rub.inv_site       si
     where si.item_nbr = 'RGB5C'
     order by si.site;

begin

  htp.tableopen(1, 'CENTER', null, null, 'cellpadding="0" cellspacing="0" ');
    htp.tablerowopen(null, 'TOP', null, null, 'style="color:#ffffff; background-color:#003399; height:17px; "');
      htp.tableheader('Site', 'LEFT', null, null, null, null, 'style="width:134px; border-left:1px solid #FFFFFF; border-top:1px solid #FFFFFF; border-bottom:1px solid #FFFFFF; padding-left:4px; "');
      htp.tableheader('Available', 'CENTER', null, null, null, null, 'style="width:70px; border-left:1px solid #FFFFFF; border-top:1px solid #FFFFFF; border-bottom:1px solid #FFFFFF; "');
      htp.tableheader('On-hand', 'CENTER', null, null, null, null, 'style="width:68px; border-left:1px solid #FFFFFF; border-top:1px solid #FFFFFF; border-bottom:1px solid #FFFFFF; border-right:1px solid #FFFFFF; "');
    htp.tablerowclose;

  for i in cur_availability loop

        if (l_detail_row_switch > 0) then
          l_row_color := '#CCCCFF';
          l_divider_color := '#FFFFFF';
        else
          l_row_color := '#FFFFFF';
          l_divider_color := '#CCCCFF';
        end if;
        l_detail_row_switch := l_detail_row_switch * (-1);

    htp.tablerowopen(null, 'TOP', null, null, 'style="background-color:#FFFFFF; height:17px; "');
      htp.tabledata(i.site, 'LEFT', null, null, null, null, 'style="border-left:1px solid '||l_divider_color||'; border-bottom:1px solid '||l_divider_color||'; padding-left:4px; background-color:'||l_row_color||'; "');
      htp.tabledata(i.available, 'RIGHT', null, null, null, null, 'style="border-left:1px solid '||l_divider_color||'; border-bottom:1px solid '||l_divider_color||'; padding-right:2px; background-color:'||l_row_color||'; "');
      htp.tabledata(i.on_hand, 'RIGHT', null, null, null, null, 'style="border-left:1px solid '||l_divider_color||'; border-bottom:1px solid '||l_divider_color||'; border-right:1px solid '||l_divider_color||'; background-color:'||l_row_color||'; "');
    htp.tablerowclose;
  end loop;
It seems like a major chore just to get what should be a very simple thing, to work right.

Hep me, hep me, please.

Gregory
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 16 2010
Added on Mar 18 2010
10 comments
1,531 views