Posts

Showing posts from 2011

Re-Sequence Tabular Form

Well, a while back I was looking at what's provided in the application builder. On a page with a number of application items - in tree view, if you right click and select Drag & Drop Layout, and then switch tabs to Reorder Items, you are presented with a tabular form. On the far right you'll will see little up and down arrow image icons, and after selecting, allows you to easily move items up or down. This is not something that comes standard, and in my opinion, something that is very useful. Once again, if we look closely, we should be able to easily replicate that functionality. Step one, I will create a table - a common one of the top of my head is statuses, so i will create a status table with 3 columns: status_id, name, sequence: CREATE table "STATUS" ( "STATUS_ID" NUMBER, "NAME" VARCHAR2(20), "SEQUENCE" NUMBER, constraint "STATUS_PK" primary key ("STATUS_ID") ) / CREATE

AJAX File Upload

Image
Ok, so I looked into this a while ago, and had all the idea's in my head, but just never got around to putting something together. Some of the newer HTML5 File API's allow you to access the file contents (base64 is what we like) - by using the FileReader object. Unfortunately, not all browsers have support for it, so you would not be able to use it accross the board. There are a lot of resources on the topic. If interested, check out: http://www.html5rocks.com/tutorials/file/dndfiles/ and https://developer.mozilla.org/en/Using_files_from_web_applications . There is another plugin out there, which supports ajax uploads with IE, but unfortunately it's commercial; which is another reason I was keen to get this happening. So anyway, I've created a demo of this - which you can check out at: http://apex.oracle.com/pls/apex/f?p=45448:afu I used the following table to get started: CREATE TABLE PLUGIN_BLOB ( ID NUMBER NOT NULL , MIME_TYPE VARCHAR2(200) , FILENAME

Item Plugin Template

This is more a reference on how to create a basic item plugin - just a text field that is exactly the same as Text item type. There is a more detailed guide for those interested on the Oracle Learning Library - http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/apex/r40/apexplugins/apexplugins_ll.htm A lot of the values to use in your plugin can be obtained from the t_page_item record, with one exception - the name attribute. For this, you need to use the function get_input_name_for_page_item. The reason for this is that APEX needs to be able to map this input field to an item in session state. This gets the necessary element name (i.e. p_t02) and adds the additional hidden element to the page - p_arg_names. With that in mind, the most basic of plugins (well, render function) - that adds no extra functionality is: function render_file_item( p_item in apex_plugin.t_page_item, p_plugin in apex_plugin.t_plugin, p_value

Expand and Collapse all Tree Nodes

APEX comes with a nice region type which is a tree view. During the wizard creation, you have the option to add buttons to expand all and collapse all nodes - but after the fact, there is no option in the tree settings to add this functionality - so you either have to recreate the tree region specifying that option or have to know what you have to do in order to add in that functionality. I came across this post on the OTN forums - http://forums.oracle.com/forums/message.jspa?messageID=4407552#4407552 - which give all the information about what you have to do to expand and collapse all nodes (I'm sure there are others, but that just happened to be the one I found). This basic gist of it is this - there are two convenience functions to do the expanding and collapsing of all nodes - apex.widget.tree.expand_all(tree_id) and apex.widget.tree.collapse_all(tree_id), respectively - where tree_id is the unique identifier of the tree. You can either hard code it in (which is what is do

Google Visualization API (Org Chart)

Wanted to have a go at making a family tree, and came across this API. It is worth noting this particular chart doesn't allow you to specify more than one node for the parent, so not exactly perfect for a family tree. See:  http://code.google.com/p/google-visualization-api-issues/issues/detail?id=162 . I believe it worthwhile to read the getting started guide for google visualizations: http://code.google.com/apis/visualization/documentation/using_overview.html and the actual guide for using the organizational chart: http://code.google.com/apis/visualization/documentation/gallery/orgchart.html . Why use this over the charts provided in APEX? For one thing, there is no organizational chart available, to my knowledge. For another, it is not flash ;-) That can only be a good thing! Alright, down to business. Firstly create a table to store the data: CREATE TABLE "PERSON" ( "PERSON_ID" NUMBER NOT NULL ENABLE, "NAME" VARCHAR2(200 BYT

APEX AJAX Basics

Introduction I'll start of by saying this post isn't about achieving any particular task via AJAX - there are plenty of examples out there already - but how to perform AJAX with Application Express. There seems to be no official documentation on the matter, so wanted to do a general overview on how to achieve AJAX techniques. Of course, it is also worth mentioning, writing your own AJAX functions is not so necessary anymore, with the addition of Dynamic Actions in APEX 4. Never the less, it is still worth knowing. The most common technique for AJAX in Application Express is to have PL/SQL code in an on demand process, and then calling that process via Javascript at run time. Application Express provides a helper function for calling an on demand process, and that is htmldb_Get (and additionally, apex.ajax.ondemand which is effectively a wrapper object for htmldb_Get object). With the release of APEX 4, came the jQuery library included - so another option for using AJAX is