Hi,
I'm working with create, edit and update functionalities for a Table stored as value in a collection using a gallery, the functionalities work as expected, but now I'm experiencing some click issues after implementing the functionalities.
Such as, the first click on a cell after entering data into a cell in the gallery Table is rejected, but the second is accepted.
This problem also occurs when trying to remove a record from the gallery table after making some updates to the gallery table
On both the cases this issue occurs immediately after some value is entered in the gallery table. This only affects the items placed inside the gallery as the 'Add Rows' button placed outside the gallery is unaffected.
@rzuber @Drrickryp @mdevaney @WarrenBelz @elseb
/You may see the code below for further understanding/
Here's the code which I used to achieve this:
In OnStart():
//The answer table is stored as a value inside a collection
//Initially a dummy collection is given in the place of the answer table, so that the table contains a row when first seen by the user
With(
//get record for the current question
{
thisQusestion:LookUp(colAnswers,(Question=galSubTopics.Selected.Question) )
},
If(
IsBlank(thisQusestion),
//if this question record is blank then create a record for this question in 'colAnswers'
Collect(
colAnswers,
{
ID:Last(colAnswers).ID+1,
Question:galSubTopics.Selected.Question,
UserTable:
ForAll(
Gallery1_8.AllItems,
{
rowNo:Value(lblRowNoSubmitForm.Text),
input1:TextInput4.Text,
input2:TextInput4_1.Text,
input3:TextInput4_2.Text
};)})
,
// if the question is not blank then edit the existing values for answer table in the record
Update(
colAnswers,
thisQusestion,
Patch(
thisQusestion,
{
UserTable: Update(
thisQusestion.UserTable,
LookUp(thisQusestion.UserTable,rowNo=ThisItem.rowNo),
{
rowNo:ThisItem.rowNo,
input1:LookUp(Gallery1_8.AllItems,rowNo=ThisItem.rowNo).TextInput4.Text,
input2:LookUp(Gallery1_8.AllItems,rowNo=ThisItem.rowNo).TextInput4_1.Text,
input3:LookUp(Gallery1_8.AllItems,rowNo=ThisItem.rowNo).TextInput4_2.Text
})}))))
With(
{thisQuestion:LookUp(colAnswers,(Question=galSubTopics.Selected.Question))},
If(
IsBlank(thisQuestion.UserTable),
//if the answer table contains no values then add records to the dummy table
Collect(
colAnswerTableValues,
{rowNo:Last(colAnswerTableValues).rowNo+1}
),
// if the answer table already contains some values then edit the values in the answer table
Update(
colAnswers,
thisQuestion,
Patch(
thisQuestion,
{
UserTable: Collect(
thisQuestion.UserTable,
{
rowNo:Last(thisQuestion.UserTable).rowNo+1,
input1:Blank(),
input2:Blank(),
input3:Blank()
})}))))
The code to remove a record from the answer table given inside the OnSelect() of'remove icon' in gallery table :
With(
{thisQuestion:LookUp(colAnswers, (Question=galSubTopics.Selected.Question))},
//remove the selected record from the answer table
Update(
colAnswers,
thisQuestion,
Patch(
thisQuestion,
{
UserTable: RemoveIf(thisQuestion.UserTable,rowNo=ThisItem.rowNo)
})))
The code to switch data sources to the gallery when the answer table contains values:

Report
All responses (
Answers (