a!gridField sorting issue

Hi ,

In my grid some of the fields are doing sorting by clicking on up n down arrow button , but for one text fields its not working.

We have not specified anything for this sorting for other fields. How we can enable to particular column where this issue is coming.

  Discussion posts and replies are publicly visible

Parents Reply Children
  • Hi ,

    Above issue resolved but sorting is not working.

    a!gridTextColumn(
    label: "Lead By",
    field: "leadBy",
    data: if(
    rule!APN_isBlank(
    ri!dataset.data
    ),
    {},
    a!forEach(
    items: index(
    ri!dataset.data,
    "leadBy",
    null
    ),
    expression: rule!TEST_getLeadershipDetails(
    fv!item
    )
    )
    )
    ),

    I have tried with local!pagingInfo , tried direct saving paginginfo at field level.Nothing is getting impact.

    PagingInfo is not able to recognized filed name . With our without same result is coming.

  • Hi Saurav,

    As per my understanding, when you are trying to sort this column, it is getting sorted by createBy field (Usernames). And then you are applying foreach on usernames to get the formatted data and display in grid. (Please note that this function will be applied on datasubset which is already sorted based on the usernames. Means sorting is done first and then computation is happening later to display data). I would suggest build the datasubset first and just use that datasubset in grid. Something like below

     load(
    local!datatoDisplay:a!forEach(ri!testSet.data,{createBy:tostring(fv!item.createBy),newColumn:tostring(user(fv!item.createBy,"firstName")&", "&user(fv!item.createBy,"lastName"))}),
    with(
    local!dataSet:todatasubset(local!datatoDisplay,ri!paggingInfo),

    a!gridField(
    label: "Paging Grid",
    labelPosition: "ABOVE",
    totalCount: local!dataSet.totalCount,
    columns: {
    a!gridTextColumn(
    label: "username",
    field: "createBy",
    data: local!dataSet.data.createBy
    ),
    a!gridTextColumn(
    label: "Test By",
    field: "newColumn",
    data: local!dataSet.data.newColumn
    )
    },
    value: ri!paggingInfo,
    saveInto: ri!paggingInfo,
    validations: {},
    shadeAlternateRows: true
    ))
    )

    Alternatively, you can use plugin function like updatecdt() to update one field in CDT with required computation and use that CDT to build datasubset for grid.

    Regards,

    Yogesh