Ajax Based parameterized report and pagination [message #489485] |
Mon, 17 January 2011 01:19 |
BBMamun
Messages: 94 Registered: February 2010 Location: Dhaka, Bangladesh
|
Member |
|
|
Hi I have searched through the web for ajax based report in Apex. I have found the following link as very useful. http://apex.oracle.com/pls/otn/f?p=31517:98
Here content of one page is pulled to the current page. It works fine. But I was thinking of something different, not pulling the content from other page. I have done it myself as follows.
--------------------------
1. Take an HTML region called Parameter
2. Take a select list in the parameter region with LOV query
name : P2_DEPTNO
LOV : Select dname d,deptno r
from dept
3.Take an HTML region
Source : <div id=ajx></div>
4. Create an Application Item called F103_DEPTNO
5. Create an Application Process
Name : getEmpTable
Source:
declare
v_deptno number(3);
begin
OWA_UTIL.mime_header ('text/xml', FALSE);
HTP.p ('Cache-Control: no-cache');
HTP.p ('Pragma: no-cache');
OWA_UTIL.http_header_close;
HTP.prn ('<table>');
HTP.prn ('<tr>');
htp.prn('<th>');
htp.prn('Employee Number');
htp.prn('</th>');
htp.prn('<th>');
htp.prn('Employee Name');
htp.prn('</th>');
htp.prn('<th>');
htp.prn('Salary');
htp.prn('</th>');
htp.prn('<th>');
htp.prn('Department');
htp.prn('</th>');
htp.prn('<th>');
htp.prn('Job');
htp.prn('</th>');
htp.prn('<th>');
htp.prn('Hiredate');
htp.prn('</th>');
HTP.prn ('</tr>');
foR R in (select empno,ename,sal,deptno,job,hiredate from emp where deptno= :F103_DEPTNO)
LOOP
htp.prn('<tr>');
htp.prn('<td>');
htp.prn(r.empno);
htp.prn('</td>');
htp.prn('<td>');
htp.prn(r.ename);
htp.prn('</td>');
htp.prn('<td>');
htp.prn(r.sal);
htp.prn('</td>');
htp.prn('<td>');
htp.prn(r.deptno);
htp.prn('</td>');
htp.prn('<td>');
htp.prn(r.job);
htp.prn('</td>');
htp.prn('<td>');
htp.prn(r.hiredate);
htp.prn('</td>');
htp.prn('</tr>');
END LOOP;
HTP.prn ('</table>');
end;
6. Write a javascript Function in HTML Header
Source:
<script language = "JavaScript" type="text/javascript">
function GetEmployees()
{
var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=getEmpTable',0);
get.add('F103_DEPTNO',html_GetElement('P2_DEPTNO').value);
gReturn = get.get();
document.getElementById('ajx').innerHTML = gReturn;
get = null;
}
</script>
7. Go to edit page item of P2_DEPTNO and in HTML Form Element Attributes write onchange="GetEmployees()"
8. Run and test.
Ajax based report works fine.
In the link specified above pagination works fine.
In my example very few records will appear but in case there are a lot of records appears then it is a must to manage it with pagination letting only a few records to appear in each page. But in my example I have no idea how to manage pagination. Need help form the experts. Please notify..
Regards
Hasan Al Mamun
Programmer
Bangladesh Bank
Dhaka, Bangladesh
[Updated on: Mon, 17 January 2011 01:24] Report message to a moderator
|
|
|
|
|
|
|