Skip to main content
sivasuryap0002
Known Participant
June 7, 2023
Question

Read-only grid

  • June 7, 2023
  • 5 replies
  • 11 views

Hi All,


I have designed a read-only grid which will be used as a child interface in other interface ,
But I ma facing one issue here,
Sometimes the grid is pre-selected with a single row automatically.
How to handle this.

Thanks in Advance,

SSP

    5 replies

    harshitb6843
    Brainy
    June 7, 2023

    Its difficult to identify the cause. Can you paste the code of your child and parent interface?

    sivasuryap0002
    Known Participant
    June 7, 2023

    a!localVariables(
    local!selection,
    local!selectedRows,
    local!data: {
    { phoneNumber: "123456", sourceName: "FB" },
    {
    phoneNumber: "789654",
    sourceName: "INSTA"
    },
    {
    phoneNumber: "13164570001",
    sourceName: "WA"
    }
    },
    a!sectionLayout(
    contents: {
    a!gridField(
    label: "TelephoneNumber",
    data: local!data,
    columns: {
    a!gridColumn(
    label: "mobileNumber",
    value: fv!row.phoneNumber,
    width: "AUTO"
    ),
    a!gridColumn(
    label: "source",
    value: fv!row.sourceName,
    width: "AUTO"
    )
    },
    pageSize: 5,
    selectable: true(),
    selectionStyle: "ROW_HIGHLIGHT",
    selectionValue: local!selection,
    selectionSaveInto: {
    local!selection,
    a!save(
    local!selectedRows,
    index(
    fv!selectedRows,
    length(fv!selectedRows),
    null
    )
    ),
    a!save(
    local!selection,
    index(save!value, length(save!value), null)
    ),
    a!save(ri!changeTelephoneNumber, true()),
    /*Intially ri!tekephoenenumber is false*/
    a!save(ri!displayGrid, false()),
    /*Intially true*/
    if(
    isnull(local!selection),
    a!save(ri!rowsSelected, false()),
    /*Intially false*/
    a!save(ri!rowsSelected, true())
    ),
    if(
    ri!rowsSelected,
    a!save(
    ri!selectedPhoneNumber,
    index(fv!selectedRows, "phoneNumber", {})/*Intially null*/

    ),
    a!save(ri!selectedPhoneNumber, null())
    )
    },
    selectionRequired: true(),
    shadeAlternateRows: true(),

    ),
    a!richTextDisplayField(
    value: a!richTextItem(
    text: "guidanceText",
    style: "EMPHASIS",
    color: "#FF0000"
    )
    )
    }
    )
    )

    Parent interface definition is straight forward just in a if condition

    konduruc733182
    Inspiring
    June 7, 2023

    Hello sivasuryap0002,

    Your code works fine for me. I don't see any preselected Values when I am using your code. Can you please check your default test inputs.