Browsing "Older Posts"

APEX-AT-WORK no image

onClick event over whole EXTJS tree node

Von Tobias Arnhold → 5.14.2010
I while ago I had an issue with the ExtJS tree. Somebody mentioned that not all parts of an ext tree node (for example the icons or the empty area) get called by an onClick event. There are just two line of code you need to add to your tree:

tree.on('click', function(node){ // tree is the created ExtJS tree object
fnc_openWindow(node.id); //this is the javascript function I call
});


Watch the whole post in the ExtJS forum to get more information about it:
http://www.extjs.com/forum/showthread.php?95597-Ext-tree-href-event-on-whole-div-element
APEX-AT-WORK no image

Highlight last inserted rows inside a standard report

Von Tobias Arnhold → 5.13.2010
To show last updated rows inside a report isn't as hard as it sounds.
All you need is a time column which saves the insert date and some changes on your report template!

Go into your report template and change it like this:

Column Template 1:
<td class="new_css_class_with_different_color" #ALIGNMENT# id="#COLUMN_HEADER#_#COLNUM#_#ROWNUM#">#COLUMN_VALUE#</td>
PL/SQL Condition:
to_date('#DATE_COLUMN#','DD.MM.YYYY HH24:MI:SS') > (SYSDATE - INTERVAL '10' MINUTE)

Column Template 2:
<td class="old_css_class" #ALIGNMENT# id="#COLUMN_HEADER#_#COLNUM#_#ROWNUM#">#COLUMN_VALUE#</td>

In this example all rows which are younger than 10 minutes will be shown with a different background color. Which is defined inside the CSS class.
APEX-AT-WORK no image

Get radio button value with javascript

Von Tobias Arnhold →
Most of you know how to get an HTML session value inside APEX:
  $x('P1_NAME').value
To get the current value from a radio button use this APEX function:
  $f_ReturnChecked('P1_DEPARTMENT')

// 1. Item: HTML Form Element Attributes:
onChange="javascript:fnc_setRadioItem('P1_DEPARTMENT')";

// 2. Page: HTML Header
<script type="text/javascript">
function fnc_setRadioItem(v_radioItem)
{
// Create AJAX request object with JavaScript class "htmldb_Get"
// 1. Parameter: Appointed for 'Partial Page Refresh', not needed
// 2. Parameter: Determined the actual application ID
// 3. Parameter: Defines the application process, I use a dummy value
// 4. Parameter: For 'Partial Page Refresh': not needed
var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=v_dummy',0);
get.add(v_radioItem,$f_ReturnChecked(v_radioItem))
gReturn = get.get();
//html_GetElement(v_radioItem).value = v_radioItem;
get = null;
}
</script>

You can find even more functions inside the APEX documentation: API Reference - 9 JavaScript APIs

Tip für die deutsche Community: APEX AJAX und JQuery HowTo Beispiel
APEX-AT-WORK no image

Run an executable file from your browser

Von Tobias Arnhold → 4.23.2010
Internet Explorer is the only browser which can run executable files. I don't know any other browser which supports this feature. Of course there are common reason why! With IE you need to use VBScript. As we all know it is not secure way of developing web application. So be careful in creating security rules inside your Internet Explorer.

This code shows two examples:

<HTML>
<HEAD>
</HEAD>
<BODY>

<SCRIPT language = "vbscript">
'define application
dim v_prog

'set command
v_prog = "C:\Programme\7-Zip\7zFM.exe"

'create a shell
set v_shell = createobject("wscript.shell")

'run application
v_shell.run(v_prog)
</SCRIPT>

<SCRIPT language = "vbscript">
'set variables
dim v_shell
dim v_return
dim v_prog

'set command
v_prog = "%SystemRoot%\system32\ping 192.168.0.1"

'create a shell
set v_shell = CreateObject("WScript.Shell")

'run application
v_return = v_shell.Run(v_prog,1,TRUE)

'check return value
if v_return = 0 then
MsgBox "Server is up",64,"Server status"
else
MsgBox "Server is down",64,"Server status"
end if
</SCRIPT>

</BODY>
</HTML>


How to: Visual Basic Scripting - http://msdn.microsoft.com/en-us/library/t0aew7h6%28v=VS.85%29.aspx
APEX-AT-WORK no image

More interesting blog posts about common APEX issues

Von Tobias Arnhold → 4.20.2010
APEX-AT-WORK no image

Get current url string

Von Tobias Arnhold → 4.19.2010

Fill select results with blank rows

Von Tobias Arnhold → 4.14.2010
To fill selects to a specific amount of rows with blank rows. Just use the rownum connect by trick:

-- select template
SELECT *
FROM (SELECT rownum, test_col
FROM test_table t
UNION ALL
SELECT *
FROM (SELECT rownum AS er, 'empty'
FROM dual CONNECT BY rownum <= 99) e
WHERE e.er > (SELECT MAX(rownum) FROM test_table));

-- emp table example for 20 rows
SELECT *
FROM (SELECT rownum, ename, job
FROM emp em
UNION ALL
SELECT *
FROM (SELECT rownum AS er, '-' as er1, '-' as er2
FROM dual CONNECT BY rownum <= 20) e
WHERE e.er > (SELECT MAX(rownum) FROM emp));

I tried the select inside the APEX SQL Workshop: