Forum Stats

  • 3,815,572 Users
  • 2,259,052 Discussions
  • 7,893,171 Comments

Discussions

Reset Interactive Report before next search

Sandijs
Sandijs Member Posts: 4
edited Mar 2, 2011 10:38AM in APEX Discussions
Hi,

I need to automatically reset Interactive Report before new search is executed. Is it possible in Apex 4.01 version?
In my case IR search should work like regular google search where only one filter at a time is applied.

I found out that filters can not be removed from private reports with APEX_UTIL.IR_CLEAR so I decided to call gReport.reset() from JavaScript and after that submit new search. I created text item P6_SEARCH_TEXT and button wich calls javascript function Search:
function Search ()
{
$('#apexir_SEARCH').val($x('P6_SEARCH_TEXT').value);
gReport.search('SEARCH');
};
This works like regular IR search.

When I add greport.reset() call to Search function, my search form stops working.
function Search ()
{
gReport.reset();
$('#apexir_SEARCH').val($x('P6_SEARCH_TEXT').value);
gReport.search('SEARCH');
};
What am I missing?

Answers

  • Vee
    Vee Member Posts: 1,580
    I think the report refresh call( gReport.reset() ) is an asynchronous process.

    So the code
    function Search ()
    {
    gReport.reset();
    $('#apexir_SEARCH').val($x('P6_SEARCH_TEXT').value);
    gReport.search('SEARCH');
    };
    is probably not going to work as you would expect it to.
    Its possible that the second and especially the third line is running before the region refreshes and this causing your page to get stuck.
    Vee
  • Sandijs
    Sandijs Member Posts: 4
    Yes, it looks like greport.reset is asynchronous.
    Is there other way to get desired result?
  • Vee
    Vee Member Posts: 1,580
    Got as far as this
    $('#apexir_REPORT').one('apexafterrefresh',function() {
      alert('after refresh');
      $('#apexir_SEARCH').val($x('P6_SEARCH_TEXT').value);
       /* gReport.search('SEARCH');  */
    });
    gReport.reset();
    When I uncomment the search request, it clears the field and does a refresh as though nothing was searched, so that needs to be figured.
    See if you can take it forward from here.
    Vee
  • Sandijs
    Sandijs Member Posts: 4
    Thank you for your input! I will let you know if I will succeed!
This discussion has been closed.