LuisMa Suárez Gutiérrez
Posts: 0
Joined: Mon Aug 18, 2014 9:12 pm

adress a spcecific (this) element in a list via JS

im making a SQLite call to increment a value. it increments ok.
next, i want to update the corresponding label in a itereated grid
but i dont know how to adrress the ' this.Apperyio("label").text ' element.

i could get around this if i just do another sql lookup and force a lookup, i want to save cycles.

var db = window.openDatabase(version, "", version, 1024*1000);

db.transaction(

Code: Select all

 function(tx) {   
     tx.executeSql('UPDATE "Tables" SET usadas=usadas+1 WHERE nombre="Abel Cortes" ' , [], function(tx, results) { }); 

 } 

);

  • this two lines fail, because i cant identify which grid element was clicked

    var usadas=parseInt(Apperyio("usadas_invisible").text);
    this.Apperyio("usadas_invisible").text(usadas+1);

    in this image, i click on the checkmark to increase the red value, this works on the local sqlite DB, but that label i cant update, unless i rerun de sql search.
    Image

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

adress a spcecific (this) element in a list via JS

Hello,

Could you check are there any errors in console? This: http://devcenter.appery.io/documentat... should help.

There is incorrect JS.

Please use:
var usadas=parseInt(Apperyio("usadas_invisible").text());
Apperyio("usadas_invisible").text(usadas+1);

instead of:
var usadas=parseInt(Apperyio("usadas_invisible").text);
this.Apperyio("usadas_invisible").text(usadas+1);

LuisMa Suárez Gutiérrez
Posts: 0
Joined: Mon Aug 18, 2014 9:12 pm

adress a spcecific (this) element in a list via JS

ok
I have a work around. I re-run the lookup service to the SQLite DB.
Not ideal. but it works.
i believe my question is very similar to this :

https://getsatisfaction.com/apperyio/...

Thanks for the correction

but the real issue is finding which Apperyio("usadas_invisible").text() I'm referring to Because it is an iterated grid

so I click on Abel 's checkmark i want abel's Apperyio("usadas_invisible").text() to increment, not Alejandro's

according to yurii's code maybe it should be
jQuery(this).closest("usadas_invisible").text(usadas+1)

LuisMa Suárez Gutiérrez
Posts: 0
Joined: Mon Aug 18, 2014 9:12 pm

adress a spcecific (this) element in a list via JS

hello?
can somebody help?

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

adress a spcecific (this) element in a list via JS

Hi -

Sorry, could you please specify the issue?

LuisMa Suárez Gutiérrez
Posts: 0
Joined: Mon Aug 18, 2014 9:12 pm

adress a spcecific (this) element in a list via JS

hi.

the problem is that when you iterate on a grid, you cant really say, " increase this member's number" id like a JS code that said " increase the value if this label that is next to me inside my grid cell"

this below is my app in the builder, one element

Image

when in run time, the grid is populated from a generic service implement with a local SQL DB and is iterated :

Image

when i click on the grid i set variables to know what person i selected, this is useful when finding which people is seated at her same table

Image

also i set her name, because i need to run a sql transaction and mark her as entered the venue so i dont have repeated checkins to the event
Image

the problem is, sometime, whith JS i want to modify the content of a certain label doing useful comparisons and run logic which i cant do with Actions.

in this picture below, i touched fabian lozano, who is seated at table 11 and by extracting his table number to a local variable i can get who else is assigned to his same table:
Image

this was done by saving his table number to a local variable and then doing this implementation on a generic service:

Image

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

adress a spcecific (this) element in a list via JS

You need use elements attributes for associating item from DB and UI component.
Please follow this example:
https://devcenter.appery.io/documenta...

Return to “Issues”