Selectable grid

Hi, I am trying build read only selectable grid.

a!localVariables(
local!businessModuleStatus: rule!CR_QE_getModuleStatusForBusiness(
cif_int: ri!cif_int,
moduleId_int: ri!moduleId_int
),
a!boxLayout(
label: index(
local!businessModuleStatus,
"workflowDesc_txt",
""
),
style: "ACCENT",
contents: {
a!gridLayout(
spacing: "DENSE",
headerCells: {
a!forEach(
items: cons!CR_MODULE_STATUS_GRID_FIELDS_FOR_BUSINESS,
expression: a!gridLayoutHeaderCell(
label: fv!item,
align: "LEFT"
)
)
},
columnConfigs: {
a!gridLayoutColumnConfig(
width: "DISTRIBUTE",
weight: 2
),
a!gridLayoutColumnConfig(
width: "DISTRIBUTE",
weight: 2
),
a!gridLayoutColumnConfig(
width: "DISTRIBUTE",
weight: 2
),
a!gridLayoutColumnConfig(
width: "DISTRIBUTE",
weight: 2
),
a!gridLayoutColumnConfig(
width: "DISTRIBUTE",
weight: 2
),
a!gridLayoutColumnConfig(
width: "DISTRIBUTE",
weight: 2
)
},
rows: {
a!forEach(
items: local!businessModuleStatus,
expression: a!gridRowLayout(
id: fv!item.inputRequestId1_int,
contents: {
a!textField(
value: fv!item.workflowDesc_txt,
readOnly: true(),
align: "LEFT"
),
a!textField(
value: rule!APN_FN_getDisplayName(
userId: fv!item.initiatedBy_txt
),
readOnly: true(),
align: "LEFT"
),
a!textField(
value: rule!CR_FN_DateTimeFormat(
input: fv!item.initiatedOn_dt
),
readOnly: true(),
align: "LEFT"
),
a!textField(
value: fv!item.moduleStatus_txt,
readOnly: true(),
align: "LEFT"
),
a!textField(
value: rule!APN_FN_getDisplayName(
userId: fv!item.approvedBy_txt
),
readOnly: true(),
align: "LEFT"
),
a!textField(
value: rule!CR_FN_DateTimeFormat(
input: fv!item.approvedOn_dt
),
readOnly: true(),
align: "LEFT"
)
}
)
)
},
selectable: true(),
selectionStyle: "ROW_HIGHLIGHT",
selectionValue: ri!inputSelectedId_int,
selectionSaveInto: {
a!save(
ri!inputSelectedId_int,
tointeger(
index(
reverse(
save!value
),
1,
null
)
)
),
a!save(
ri!systemSelectedId_int,
index(
local!businessModuleStatus,
"systemRequestId_int",
""
),

)
},
selectionRequired: true()
)
}
)
)

On selection of row one variable will get updated due to Id of a row, then if i retrieve value for second variable from localvariable. It is not updating for second variable if I select a new row.

Can someone suggest on this?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    Hi, After selection , you dont need to index to choose selected row, you can just  use fv!selectedRows for selection  and fv!deselectedRows for deselection. You can go through the link provided by viraty as well.

  • a!localVariables(
    local!businessModuleStatus: rule!CR_QE_getModuleStatusForBusiness(
    cif_int: ri!cif_int,
    moduleId_int: ri!moduleId_int
    ),
    local!selectedId_int,
    local!selectedValues,
    a!boxLayout(
    label: index(
    local!businessModuleStatus,
    "workflowDesc_txt",
    ""
    ),
    style: "ACCENT",
    contents: a!gridField(
    data: local!businessModuleStatus,
    columns: {
    a!gridColumn(
    label: cons!MODULE_STATUS_GRID_FIELDS_FOR_BUSINESS[1],
    sortField: cons!CR_APP_MODULE_STATUS_GRID_FIELDS_FOR_BUSINESS[1],
    value: fv!row.workflowDesc_txt
    ),
    a!gridColumn(
    label: cons!MODULE_STATUS_GRID_FIELDS_FOR_BUSINESS[2],
    sortField: cons!CR_APP_MODULE_STATUS_GRID_FIELDS_FOR_BUSINESS[2],
    value: rule!APN_FN_getDisplayName(
    userId: fv!row.initiatedBy_txt
    ),

    ),
    a!gridColumn(
    label: cons!CR_APP_MODULE_STATUS_GRID_FIELDS_FOR_BUSINESS[3],
    sortField: cons!CR_APP_MODULE_STATUS_GRID_FIELDS_FOR_BUSINESS[3],
    value: rule!CR_FN_nbfDateTimeFormat(
    input: fv!row.initiatedOn_dt
    ),

    ),
    a!gridColumn(
    label: cons!CR_APP_MODULE_STATUS_GRID_FIELDS_FOR_BUSINESS[4],
    sortField: cons!CR_APP_MODULE_STATUS_GRID_FIELDS_FOR_BUSINESS[4],
    value: fv!row.moduleStatus_txt
    ),
    a!gridColumn(
    label: cons!CR_APP_MODULE_STATUS_GRID_FIELDS_FOR_BUSINESS[5],
    sortField: cons!CR_APP_MODULE_STATUS_GRID_FIELDS_FOR_BUSINESS[5],
    value: rule!APN_FN_getDisplayName(
    userId: fv!row.approvedBy_txt
    )
    ),
    a!gridColumn(
    label: cons!CR_APP_MODULE_STATUS_GRID_FIELDS_FOR_BUSINESS[6],
    sortField: cons!CR_APP_MODULE_STATUS_GRID_FIELDS_FOR_BUSINESS[6],
    value: rule!CR_FN_nbfDateTimeFormat(
    input: fv!row.approvedOn_dt
    ),

    ),

    },
    selectable: true,
    selectionStyle: "ROW_HIGHLIGHT",
    selectionValue: local!selectedId_int,
    selectionSaveInto: {
    local!selectedId_int,
    /*a!save(*/
    /*local!selectedId_int,*/
    /*tointeger(*/
    /*index(*/
    /*reverse(*/
    /*fv!selectedRows*/
    /*),*/
    /*1,*/
    /*null*/
    /*)*/
    /*)*/
    /*),*/
    a!save(
    local!selectedValues,
    append(
    local!selectedValues,
    fv!selectedRows
    )
    ),
    a!save(
    local!selectedValues,
    difference(
    local!selectedValues,
    fv!deselectedRows
    )
    ),
    a!save(
    ri!inputSelectedId_int,
    local!selectedValues.inputRequestId1_int
    ),
    a!save(
    ri!systemSelectedId_int,
    local!selectedValues.systemRequestId_int
    )
    }

    Now I am getting both values ,but it is selecting mutliple rows but my requirement is single row to be selected. Can you please help in this?

  • 0
    Certified Senior Developer
    in reply to JS0001

    you can restrict the row selection please refer this Limit Grid Selection to One Row

Reply Children