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
Hi saurak,
You have to define field attribute in a!gridTextColumn() to make that field sort as shown bellow.
a!gridTextColumn( label: "Text Column", data: {}, field:"firstName" )
its declared already. I am able to click on column header but its not sorting.
its text only.
Can you share your code and error that your getting, that might helps us to better understand .
a!gridTextColumn( label: "Test By", field: "createBy", data: if( rule!APN_isBlank( ri!testSet.data ), {}, a!forEach( items: index( ri!testSet.data, "testBy", null ), expression: rule!HELLO_getUserName( fv!item ) ) ) ),
Error is: Nothing is happening after clicking on column header.
I think data your mapping is "testBy" and doing sorting by "createBy" is both same data type ? and try to give index instead dot(.) in data.
yes both are same data type. Plz update where you are saying. Then will try again
Try This,
{ with( local!gridValues: todatasubset( index( ri!testSet, "data", null ), ri!paggingInfo ), a!gridField( label: "Paging Grid", labelPosition: "ABOVE", totalCount: 0, columns: { a!gridTextColumn( label: "Test By", field: "createBy", data: if( rule!APN_isBlank( local!gridValues.data ), {}, a!forEach( items: index( index( local!gridValues, "data", {} ), "createBy", null ), expression: rule!HELLO_getUserName( fv!item ) ) ) ) }, value: ri!paggingInfo, saveInto: ri!paggingInfo, validations: {}, shadeAlternateRows: true ) )}
getting below error.
Error Evaluating UI ExpressionExpression evaluation error in rule 'grid rule' (called by rule 'interface name') at function a!gridField: A grid component [label=“Hello to all”] has an invalid value for “columns” and “value”. All “data” arrays must not contain more items than the specified “batchSize”, but “batchSize” was 10 and the largest column data array had 500 items
Make changes to total count :
totalCount: index(local!gridValues,"totalCount",null),
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