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!

Embed jquery data() method into sql query

Eslam_ElbyalyFeb 24 2019 — edited Feb 25 2019

Apex 18.2.

Hi,

a tab container with two tabs"categories" and "items" which are two classic reports based on a modified "Cards" template. I just added the #CARD_ATTRIBUTES# substitution to the "categories" classic report to add "data-id" custom attribute to get the "ID" of the category clicked by the user through adding data-id= "#ID#" to the #CARD_ATTRIBUTES# column.

I can switch the tab successfully.

I am retrieving the category id value through data() method

var catId = $(this.triggeringElement).data('id');

First tab is for displaying "item categories".

Second tab is for displaying "items" under the category clicked by the user.

When the user clicks a category it should switch the tab to "items" tab and refresh the items region query.

the query for categories region is,

select ID,

       NAME CARD_TEXT,

       DESCRIPTION CARD_SUBTEXT,

       DBMS_LOB.GETLENGTH(IMG) CARD_TITLE ,

null CARD_ATTRIBUTES,

       FILENAME,

       MIME_TYPE,

       CHARACTER_SET,

       LAST_UPDATED

  from ITEM_CATEGORY

The query for items region is,

select ID,

       NAME CARD_TEXT,

       DESCRIPTION,

       DEFAULT_SALE_PRICE CARD_SUBTEXT,

       CATEGORY,

       DBMS_LOB.GETLENGTH(IMG) CARD_TITLE,

NULL CARD_ATTRIBUTES,

       FILENAME,

       MIME_TYPE,

       CHARACTER_SET,

       LAST_UPDATED

  from ITEM

I just want to add the category id retrieved by " catId = $(this.triggeringElement).data(); " to the items region query. i.e

"..... Where id = catId; "

but of course I can not add the javascript variable "catId" or the Jquery data() method to a SQL query.

The solution that comes to my mind is to add a page item and assign the "catId" variable value to it and adds that page item to the query. But I am not comfortable to that solution.

Is there any other solution?

Comments
Post Details
Added on Feb 24 2019
3 comments
1,760 views