Browsing "Older Posts"

First impressions of developing an APEX plugin

Von Tobias Arnhold → 12.20.2010
After spending a couple of hours in building my first plugin. I came to the conclusion to create a plug-in which uses the UILayout technology. My first idea was to build my own solution. After studying the documentation of UILayout I only thought that's the tool I want to work with! :)

Now after I created a working template I thought of how to include this into a plug-in?

First idea: Don't change anything on the page template if you have a similar organization of your page (North, West, South, East, Center)!
You say what you want in what area of the UILayout (West, North, Center...) inside the plug-in. To achieve that you take ID's or Classes of the main elements of your page template.
Part of the standard page template:


Plugin settings:


As you see I almost only use the standard ID's. Only the west div is not part of the original template.

After I created a first easy solution. I thought about the source code and the available attributes in the APEX plugin (max. 10)! 10 Attributes would only be enough for the sizing of the areas and would never be enough for all settings I need.

Second idea: I will build several modular plug-ins where everyone creates a special part of the layout.
1. Layout creation and region assigning
2. Area sizing (Size, Min-Size, Max-Size, No area at all)
3. Look and Feel (background-color,border-color,...)
4. Place for more ideas like Dynamic Layout Add-ons

What do you think? Developing a plug-in like that makes it maybe more complicated to configure. On the other side I would need comma separated lists if I only would use one plug-in!

Your opinion is appreciated.

Anyway I wish everybody a Merry Christmas and a successful APEX year 2011!
APEX-AT-WORK no image

Problem refreshing Interactive Report with Dynamic Action

Von Tobias Arnhold →
It happened now two times that I wanted to update an IRR by a Dynamic Action. It just did not worked! The Dynamic Action fired (I saw that by debugging with Firebug and APEX) but the Report did not update. Finding the solution costs me some minutes/hours!

Reason: I assigned no Region template to the IRR (User Interface > Template : No Template)

Solution: I created a new empty region template and used that instead of "No Template".
APEX-AT-WORK no image

Ein paar nützliche Informationen zum APEX Autocomplete Item

Von Tobias Arnhold → 12.15.2010
1. Das Item basiert auf dem JQuery Plugin: Autocomplete. Wenn Sie nähere Informationen zur Funktionsweise suchen, dann schauen Sie auf dieser Seite nach.

2. Tyler Muth erstellte unter APEX 3 eine Erweiterung für APEX: jquery-autocomplete-for-apex

3. Seit APEX 4 ist es ein Standard Item Type

4. Innerhalb des APEX Items können Sie spezielle Einstellungen für diesen Item Type vornehmen. Die wichtigste Einstellung ist die "Search"-Einstellung, Sie beinhaltet "Exact" oder "Contains" zur Auswahl.
Der entscheidende Unterschied ist die Art der Suche!
Bei dem Exact Verfahren wird ein Select ähnlich diesem während der Laufzeit aufgebaut:

-- Exact
SELECT a.*
FROM (SELECT DISTINCT CITY AS RV
FROM address_data ad
WHERE ad.country = :P1_COUNTRY
ORDER BY 1) a
WHERE "RV" LIKE :p$_search_string || '%' AND ROWNUM <= :p$_max_rows;

Wobei bei dem Contains Verfahren die INSTR Funktion verwendet wird:

SELECT a.*
FROM ( SELECT DISTINCT CITY AS RV
FROM address_data ad
WHERE country_id = :P1_COUNTRY
ORDER BY 1) a
WHERE INSTR ("RV", :p$_search_string) > 0 AND ROWNUM <= :p$_max_rows;

Bei der Verwendung von Indizes kann diese Info von entscheidenden Vorteil sein.
Ich habe zu diesem Thema vor kurzem auch eine Forum Anfrage gestartet: Problem with Textfield autocomplete --> only uses the INSTR function

5. Speichern Sie Werte nach jeder Eingabe durch eine Dynamic Action in der APEX Session *:
Event: Lose Focus
Selection Type: Item(s)
Item(s): P1_CITY
TRUE Action: Execute PL/SQL Code
PL/SQL Code: null;
Page Items To Submit: P1_CITY

6. Löschen Sie den Cache der Autocomplete Ergebnisliste durch eine Dynamic Action *:
Event: Lose Focus
Selection Type: Item(s)
Item(s): P1_CITY
TRUE Action: Execute Javascript Code
Code: $('#P1_STREET').flushCache(); $('#P1_ZIP').flushCache();

7. Sie können durch ein wenig Aufwand auch direkt durch TAB in das nächstes Input Item springen (Achtung: Item zurück SHIFT-TAB ist in der Lösung nicht möglich!)
Event: Key Release
Selection Type: Item(s)
Item(s): P1_CITY
TRUE Action: Execute Javascript Code
Code:

var vEvent = this.browserEvent.keyCode;
var vEl = this.triggeringElement;
var vName = this.triggeringElement.id;
var vButton = "9"; /* TAB Key */

/* Check ob Event TAB Press ist */
if (vEvent == vButton){

if (vName == 'P1_CITY'){
/* Flush Cache aller anderen Autocomplete Items */
$('#P1_ZIP').flushCache(); $('#P1_STREET').flushCache();
/* Sprung in naechstes Item - manuelle Vorgabe */
setTimeout(function() {$('#P1_STREET').focus();}, 1);
}

if (vName == 'P1_STREET'){
$('#P1_ZIP').flushCache(); $('#P1_CITY').flushCache();
setTimeout(function() {$('#P1_STREET_NO').focus();}, 1);
}
}


8. Aktuell fehlt noch das Lade-Icon das während der Suche im Item angezeigt wird. Dieses Problem wird in APEX 4.1 behoben sein. Workaround: APEX Page item Text Field with autocomplete doesn't show load icon

* Wichtig bei der Verwendung mehrerer Autocomplete Items auf einer Seite, da sonst der Such-Wert fehlen könnte!

Working on my first APEX Plugin

Von Tobias Arnhold → 12.12.2010
It gets time to start developing my first APEX Plugin. I thought first to develop an addon with the JQuery UI.Layout for APEX.

Layout manager like ExtJS or UI.Layout are nice but hard to integrate. Especially for the different APEX templates and there specific design.

Instead of using one of these plugins I develop my own one. Which only uses a dynamic left area (west) and makes the center area (body) depended on the left area.

My goal is that the new plugin runs nice with the new standard APEX templates. Older templates should easily be migrate able.

First pictures:

APEX-AT-WORK no image

Preload images in APEX

Von Tobias Arnhold → 12.11.2010
Sometimes images doesn't appear immediately (for example loading icons called before onSubmit processes). Especially new users who doesn't have these images inside there browser cache could be happy to see them. :)

The workaround is quite easy. Just create a Dynamic Action like below:

Create Dynamic Action: preload_images
Event: Page Load
Action: Execute JavaScript Code
Code:

var a_imgList = new Array();
// Your images
a_imgList[0] = "/i/company/loading1.gif";
a_imgList[1] = "/i/company/loading2.gif";
a_imgList[2] = "/i/company/button1.gif";
a_imgList[3] = "/i/company/button2.gif";

var a_images = new Array()

for (i = 0; i < a_imgList.length; i++) {
a_images[i] = new Image();
a_images[i].src = a_imgList[i];
}

Create Dynamic Action

That's it! You probably would add this event on your login page 101.