Hi,
I have list of maps in a local variable . I am using it in grid field . I need to apply sort to the columns. Sorting is supported only when the data is from query entity or record. Is there any workaround where we can manually apply sort to the grid when the data is a list of map. Sample code.
a!localVariables( local!data: { a!map(id: 1, uin: 234, count: 5, ), a!map(id: 2, uin: 232, count: 5, ), a!map(id: 3, uin: 28, count: 5, ) }, a!gridField( data: local!data, columns: { a!gridColumn(label: "ID", value: fv!row.id), a!gridColumn(label: "UIN", value: fv!row.uin), a!gridColumn(label: "COUNT", value: fv!row.count) } ) )
Can you please help me with the sorting
Discussion posts and replies are publicly visible
You can try this
a!localVariables( local!pagingInfo: a!pagingInfo( startIndex: 1, batchSize: 50, sort: a!sortInfo(field: "id", ascending: true) ), local!data: { a!map(id: 1, uin: 234, count: 5), a!map(id: 2, uin: 232, count: 5), a!map(id: 3, uin: 28, count: 5) }, a!gridField( data: todatasubset(local!data, local!pagingInfo), columns: { a!gridColumn( label: "ID", sortField: "id", value: fv!row.id ), a!gridColumn( label: "UIN", sortField: "uin", value: fv!row.uin ), a!gridColumn( label: "COUNT", sortField: "count", value: fv!row.count ) }, pagingSaveInto: local!pagingInfo ) )
It is working. Thank you