Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

APEX TABULAR Form: Giving a column a name or ID to reference in JQuery rather than its array value

Richard LeggeDec 8 2015 — edited Jan 23 2016

Hi All,

APEX 4.2 SE 12.1

Is there an easy way to give a column an element name, or ID so I don't need to use the array names (i.e. "f03" etc)   I have a number of tabular forms where there is quite a bit of javascript updating other columns based on dynamic actions and the JQuery Selector, and adding columns to the tab form becomes problematic.

At the moment, Im using the cell name (f03) as the reference.. i.e.   the selector  [name="f03"], then looking for the other cell names nearby using the following code:


here is my element:

<input type="text" name="f05" size="50" maxlength="2000" value="TEST ROW" id="f05_0001" autocomplete="off">


thisElement = apex.jQuery('#'+this.triggeringElement.id);

row = thisElement.closest('tr');

gross_amount = row.find('[name="f03"]');

gross_amount.val();    <-  returns the contents of cell is name f03.. All OK..

This works fine. The problem, is that have a lot of Javascript with these references in, and now I need to add a couple of columns. This throws out all my references to the correct columns as the array numbers change. (so I have to go through all the Javascript code and change the references.

I thought If I changed the columns to APEX_ITEMS, and added an ID. I could then reference a static ID, but its stopped everything working, and my columns Ive defined don't save..

(I'm assuming because I now need to do a manual save..

)

the element is below.

<input type="text" name="f30" size="20" maxlength="2000" value="100" id="NET_AMOUNT" autocomplete="off">

selector [id="NET_AMOUNT"]

thisElement = apex.jQuery('#'+this.triggeringElement.id);

alert(thisElement.val();                        <- this says undefined.

aleret(thisElement.text();                     <- gives me the column header instead of the cell contents.

This triggers when I change the value in this cell,  however when I look at  the value, its undefined, and if I look at thisElement.text())  I get the column header text.. For some reason thisElement is returning the contents of the header cell and not the cell contents..

So, what would be the best way to add a static ID or name to the column cell to reference so that when I add columns, I don't need to change the code.. ? If it is via using APEX_ITEM, and adding an ID, how do I then reference the cell correctly, and is there any way to get it to save automatically..

Many Thanks

Richard

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 7 2016
Added on Dec 8 2015
9 comments
3,897 views