Table, select if click/touch on row

-Arduino Mega2560
-Android Verson 9
-Blynk Server
-Blynk Library version 2.27.19

I like to work with clickable rows in the table. To create the table I use the following code. This code works pretty good.

// Einrichten Tabelle Status Timer Settings
WidgetTable table;
BLYNK_ATTACH_WIDGET(table, V2); //Anlegen table Rolladen Status

//table
void TimerSet() {
for (int p=0; p<12; p++) {
Blynk.virtualWrite(V2, “add”, p, RolladenStatus[p], “hand”);
}
} // end Einrichten table Timer Settings

Now I like to click on the row to change the value. In “Table Settings” “Clickable Rows” is “YES”
But I have no idea how the code must look like. Idea is to check if row ist selected and then change the value in the table. I found this code und Blynk.cc:

BLYNK_WRITE(V1) {
   String cmd = param[0].asStr();
   if (cmd == "select") {
       //row in table was selected. 
       int rowId = param[1].asInt();
   }
   if (cmd == "deselect") {
       //row in table was deselected. 
       int rowId = param[1].asInt();
   }
   if (cmd == "order") {
       //rows in table where reodered
       int oldRowIndex = param[1].asInt();
       int newRowIndex = param[2].asInt();
   }
}

There are quite a few examples on this forum. Have you searched a studied them?

Pete.

Hi pete,
yes I searched for “table and select”. But I haven’t found an example of what I could use.
I generate a table like this:

WidgetTable table;
BLYNK_ATTACH_WIDGET (table, V2); // Create table shutter status

// table
void TimerSet () {
for (int p = 0; p <12; p ++) {
Blynk.virtualWrite (V2, “add”, p, ShutterStatus [p], “hand”);
}
}

now I want to query whether a line has been pressed (cmd == “select”). I have no idea how to do it. Can you help me? Thank you.

Try this…

BLYNK_WRITE(V2)
{
   String cmd = param[0].asStr();
   if (cmd == "select")
   {
       int rowId = param[1].asInt();
       Serial.print(“Table row “);
       Serial.print(rowId);
       Serial.println(“ was pressed”);

       Serial.print(“Table Values updated...“);
       Blynk.virtualWrite(V2, "update", rowId, "UpdatedName", "UpdatedValue");

   }
}

Pete.
Pete.