Nor newbie and nor advanced apex user here,
But,
I'm very naive on major client side web languages, and now I need to face it. And soon.
I have an example here - user : test and password test.
I'm based on the very same jquery and javascript function from here, answered by Mr. Tony Andrews.
At my app example, when the priority field is changed it puts in the value of A field, when its not 0, nor null . Its simply multiply the result in that field.
I'm trying to put a change priority script from priority field when its change. For example: When would change the priority of id=1, to 1, the priority from id=2 must be changed to 3 - the original priority from id=1.
I know it's a very basic algorithm, but I don't know how to do it just in time, on javascript or jQuery calls on apex. I'm been trying to more complex manipulations on report, but I need to understand the basics first.
For clarification my query report and javascript execution is:
select distinct
apex_item.checkbox2(10,r.ID) ID,
apex_item.text(11,r.ID) ID_2,
apex_item.text(20,r.PRIORIDADE) PRIORITY,
apex_item.text(30,1) a,
apex_item.SELECT_LIST_FROM_LOV(31,r.PRIORIDADE,'LISTAPRIORIDADES',NULL,'NO') PRIORITY_LOV,
apex_item.text(40,null) b,
(select seq_id from apex_collections c where collection_name = 'COLECAO' AND c001 = r.id
)sequencial
from REPRIORIZA r
order by id;
//javascript execution, on dynamic action:
var target = apex.jQuery(this.triggeringElement).closest('tr').find('input[name="f30"]')
console.log(target)
var source = apex.jQuery(this.triggeringElement).closest('tr').find('input[name="f20"]')
console.log(source)
var result = target.val() * source.val();
target.val(result);
console.log(target)
var target2 = apex.jQuery(this.triggeringElement).closest('tr').find('input[name="f40"]')
console.log(target)
var source2 = apex.jQuery(this.triggeringElement).closest('tr').find('input[name="f11"]')
console.log(source2)
var result2 = source2.val();
target2.val(result2);
Regards,
There are a few ways to do this, my suggestion is as follows:
1 - Use the attributes 'p_attributes' and 'p_item-id' in your select when do you write apex_item code, like this:
https://docs.oracle.com/cd/E14373_01/apirefs.32/e13369/apex_item.htm#AEAPI211
https://docs.oracle.com/cd/E14373_01/apirefs.32/e13369/apex_item.htm#AEAPI206
When you do this, you can access every item from the same line easily. These select is from a example table in my workspace, adapt these data to your table.
2 - Create a dynamic action to trigger when change the lov, this dynamic action should execute a javascript code.
3 - In your javascript code of this DA you can get every element of the line with this code:
Now you can do everything with lovItem, aItem and priorityItem fields.
4 - in your example page, the id column are sequential, so you can get the next line just incrementing the lineId variable like this:
*If the values are not sequential, maybe you can create one more attribute in your apex_item on the "p_attributes" parameter using lead or lag function. https://oracle-base.com/articles/misc/lag-lead-analytic-functions
Well,
For the case what I asked a possible answer is :
This code will change the value between one existing in another row. Tks for previous contributions!