Page 1 of 1

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

Posted: Wed Jun 03, 2015 1:25 am
by LuisMa Suárez Gutiérrez

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


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

Posted: Wed Jun 03, 2015 5:00 pm
by Serhii Kulibaba

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);


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

Posted: Wed Jun 03, 2015 5:11 pm
by LuisMa Suárez Gutiérrez

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)


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

Posted: Sun Jun 07, 2015 6:44 am
by LuisMa Suárez Gutiérrez

hello?
can somebody help?


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

Posted: Sun Jun 07, 2015 10:17 am
by Illya Stepanov

Hi -

Sorry, could you please specify the issue?


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

Posted: Sun Jun 07, 2015 11:07 am
by LuisMa Suárez Gutiérrez

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


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

Posted: Tue Jun 09, 2015 10:07 am
by Serhii Kulibaba

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