Read-only grid

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

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 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

  • 0
    Certified Senior Developer
    in reply to sivasuryap0002

    Hello ,

    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.

  • 0
    Certified Senior Developer
    in reply to sivasuryap0002

    Sometimes the grid is pre-selected

    What do you mean by "sometimes"? Looking at your code, I can say that it is not possible. Do you have any supporting proofs, like a clip or something?

  • It might be that when you select for the first time, and then when you open the interface again, then the local don't loose their values and hence you see them preselected. You need set null to the selection local variable in order to achieve a fresh new state everytime.