官术网_书友最值得收藏!

Listbox: Applying Deselect All on rerun

There is a report where users can select multiple product lines from a listbox. When they rerun the report, the previous selection is remembered.

Users want the selection to be automatically cleared on re-run.

Getting ready

Select any existing report or create a new sample report that filters on Product Lines. Create a Listbox type of prompt for the product line. Set its multi-select property to Yes.

How to do it...

  1. Wrap the listbox in a span similar to previous recipes; that is, create two HTML items around the listbox and define span A1.
    How to do it...
  2. Now define a new HTML item in prompt page footer as follows:
    <script>
    var theSpan = document.getElementById("A1");
    var a = theSpan.getElementsByTagName("A");
    for( var i = a.length-1; i >= 0; i-- )
    { var link = a[i];
    if( typeof(link.id) == "string" && link.id.match(/PRMT_(SV|LIST)_LINK_DESELECT_/) )
    {link.fireEvent("onclick");}
    }
    </script>
  3. Run the report for any product line. Then re-run the report by clicking the RunHow to do it... button. Notice that the previous prompt selection is cleared.
How to do it...

How it works...

With a multi-select listbox control, Report studio throws in two links on the prompt page. These are for SELECT ALL and DESELECT ALL functionalities.

Here we are capturing the Deselect all link and then calling it by fireevent() function.

There's more...

You can optionally check for PRMT_(SV|LIST)_LIST_SELECT in the Id and call the Select All link when appropriate.

Also, you can use the following line in script if you want to remove a link from the page at run time:

link.parentNode.removeChild(link)
主站蜘蛛池模板: 康平县| 贵阳市| 乐山市| 河北区| 怀化市| 松江区| 磐石市| 明溪县| 永胜县| 井陉县| 唐海县| 合山市| 深圳市| 灵武市| 元阳县| 敦煌市| 思茅市| 视频| 广灵县| 金平| 东阳市| 武胜县| 寿光市| 忻州市| 襄垣县| 甘谷县| 如东县| 交城县| 武鸣县| 凤翔县| 昌吉市| 普定县| 体育| 黎川县| 会泽县| 孟村| 泸溪县| 信丰县| 荣成市| 贵州省| 团风县|