Home » Developer & Programmer » Application Express, ORDS & MOD_PLSQL » Ajax Based parameterized report and pagination (Apex 3.2.1, Win xp)
Ajax Based parameterized report and pagination [message #489485] Mon, 17 January 2011 01:19 Go to next message
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

Re: Ajax Based parameterized report and pagination [message #489491 is a reply to message #489485] Mon, 17 January 2011 01:41 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags.
Use the "Preview Message" button to verify.

Regards
Michel
Re: Ajax Based parameterized report and pagination [message #489500 is a reply to message #489491] Mon, 17 January 2011 02:32 Go to previous messageGo to next message
BBMamun
Messages: 94
Registered: February 2010
Location: Dhaka, Bangladesh
Member
Thanks for notifying. I will use formating suggestion next time.
Re: Ajax Based parameterized report and pagination [message #490599 is a reply to message #489485] Wed, 26 January 2011 00:40 Go to previous messageGo to next message
BBMamun
Messages: 94
Registered: February 2010
Location: Dhaka, Bangladesh
Member
Hi, I have searched for the solution through the web and found some solutions. There is much simpler solution to it which don't even use Application Process and PL/SQL. I have customized the solution my way in Oracle apex host server.

Please Check the following link

http://apex.oracle.com/pls/apex/f?p=42771:2

Regards

Hasan Al Mamun
Re: Ajax Based parameterized report and pagination [message #490688 is a reply to message #490599] Wed, 26 January 2011 13:54 Go to previous message
Its_me_ved
Messages: 979
Registered: October 2009
Location: India
Senior Member
Thanks for demo. Well, there is another feature so called 'Dynamic Action'. You can look at it.

Regards
Ved
Previous Topic: oehr_sample_objects zip is corrupted
Next Topic: CSS Header doctype
Goto Forum:
  


Current Time: Thu Mar 28 16:38:47 CDT 2024