Issue with Editable Grid

Certified Lead Developer

Hi,

I am having editable grid with selection enabled where as the data will be populated based on the selection value in the milestone field.

In which we need to include one of the column as required whenever the selection is enabled.For that I have included the below code snippet in the gridrowlayout.

a!textField(
value: fv!item.item,
saveInto: fv!item.item,
required: if(
contains(
tointeger(
local!selectedIndex
),
tointeger(
fv!item.id
)
),
true(),
false()
),

)

After including the above code, whenever the first row item of first milestone is selected,first item of all the remaining milestone field is  also getting selected.If we remove the above highlighted snippet it is working fine.Also this is happening in Appian 19.2 and 19.3 version.It is working in 19.4.Did anyone face similar issue?Can anyone please help me on this.

Attaching the full source code here.

a!localVariables(
local!selectedIndex,
local!currentStep: 1,
local!activeCategory,
local!category: {
"Hardware",
"Software",
"Pharma",
"Electrical"
},
local!items: {
{
id: 1,
item: "Item 1",
qty: 1,
unitPrice: 10,
category: "Hardware"
},
{
id: 2,
item: "Item 2",
qty: 2,
unitPrice: 20,
category: "Software"
},
{
id: 3,
item: "Item 3",
qty: 2,
unitPrice: 20,
category: "Pharma"
},
{
id: 4,
item: "Item 4",
qty: 2,
unitPrice: 30,
category: "Electrical"
},
{
id: 5,
item: "Item 5",
qty: 1,
unitPrice: 10,
category: "Hardware"
},
{
id: 6,
item: "Item 6",
qty: 2,
unitPrice: 20,
category: "Software"
},
{
id: 7,
item: "Item 7",
qty: 2,
unitPrice: 40,
category: "Pharma"
},
{
id: 8,
item: "Item 8",
qty: 2,
unitPrice: 20,
category: "Electrical"
}
},
a!formLayout(
contents: {
a!milestoneField(
label: "",
steps: {
local!category
},
links: {
a!forEach(
items: local!category,
expression: a!dynamicLink(
saveInto: {
a!save(
local!activeCategory,
fv!item
),
a!save(
local!currentStep,
fv!index
)
}
)
)
},
active: local!currentStep
),
a!gridLayout(
label: local!activeCategory,
selectable: true,
selectionSaveInto: {
local!selectedIndex,
a!save(
local!selectedIndex,
reject(
fn!isnull(
_
),
a!flatten(
save!value
)
)
)
},
selectionValue: local!selectedIndex,
instructions: "Update the item name, quantity, or unit price.",
headerCells: {
a!gridLayoutHeaderCell(
label: "Item"
),
a!gridLayoutHeaderCell(
label: "Qty",
align: "RIGHT"
),
a!gridLayoutHeaderCell(
label: "Unit Price",
align: "RIGHT"
),
a!gridLayoutHeaderCell(
label: "Total",
align: "RIGHT"
)
},
rows: a!forEach(
items: local!items,
expression: if(
isnull(
local!activeCategory
),
{},
if(
fv!item.category = local!activeCategory,
a!gridRowLayout(
id: fv!item.id,
contents: {
a!textField(
value: fv!item.item,
saveInto: fv!item.item,
required: if(
contains(
tointeger(
local!selectedIndex
),
tointeger(
fv!item.id
)
),
true(),
false()
),

),
a!integerField(
value: fv!item.qty,
saveInto: fv!item.qty,
align: "RIGHT"
),
a!floatingPointField(
value: fv!item.unitPrice,
saveInto: fv!item.unitPrice,
align: "RIGHT"
),
a!textField(
value: dollar(
tointeger(
fv!item.qty
) * todecimal(
fv!item.unitPrice
)
),
readOnly: true,
align: "RIGHT"
)
}
),
{}
)
)
),
rowHeader: 1
)
},
buttons: a!buttonLayout(
primaryButtons: a!buttonWidget(
label: "submit",
submit: true,

)
)
)
)

Thanks in Advance!!!

Regards,

Subha

  Discussion posts and replies are publicly visible

Parents
  • It's a little hard to tell because I am currently on 19.4 and it works for me. However, I'm confused by this section:

    selectionSaveInto: {
      local!selectedIndex,
        a!save(
          local!selectedIndex,
          reject(
            fn!isnull(
              _
            ),
            a!flatten(
              save!value
            )
         )
      )
    },

    Why are you saving into the same variable twice? Also, why do you need the reject() and a!flatten() functions applied to the selected index()? I'm wondering if this behavior is causing the index to be updated to an incorrect value, which makes your first row always seem selected.

Reply
  • It's a little hard to tell because I am currently on 19.4 and it works for me. However, I'm confused by this section:

    selectionSaveInto: {
      local!selectedIndex,
        a!save(
          local!selectedIndex,
          reject(
            fn!isnull(
              _
            ),
            a!flatten(
              save!value
            )
         )
      )
    },

    Why are you saving into the same variable twice? Also, why do you need the reject() and a!flatten() functions applied to the selected index()? I'm wondering if this behavior is causing the index to be updated to an incorrect value, which makes your first row always seem selected.

Children