Is it possible to disable sorting on a paging grid?

Hi all,
Is it possible to disable sorting on a paging grid?
If yes, how can this be done....

OriginalPostID-105771

OriginalPostID-105771

  Discussion posts and replies are publicly visible

  • Ignore the new sort information thrown by the grid when user click on a field for sorting, and replace it with the default sort info that you already have in a variable. Following code could do the trick.

    load(
    local!sortInfo:a!sortInfo(field:"yourWish", ascending:false),
    local!pagingInfo: a!pagingInfo(
    startIndex:1,
    batchSize:5,
    sort: local!sortInfo
    ),

    a!gridField(
    ====
    ====
    value:local!pagingInfo,
    saveInto:{
              local!pagingInfo,
              local!pagingInfo.sort << rule!APN_returnFirstInput(local!sortInfo,_)
    }
    )
    )
  • Hi gouthamk!!

    May I know what this rule!APN_returnFirstInput(local!sortInfo,_) includes? Please can you mention in detail.
  • Hi Praveen, which version of Appian are you working with ? Usage of any dummy rules in saveInto block (like rule!APN_returnFirstInput) to store a different value into a variable is an obsolete approach, as with the inception of a!save() function in recent releases of Appian. Check if you have this new function available in your environment and it's very simple to use as follows...

    The code snippet we are interested in from the above code now changes as follows...

    saveInto:{
              local!pagingInfo,
              a!save(local!pagingInfo.sort, local!sortInfo),
              local!dataSubsetForGrid: fn!todatasubset(local!data, local!pagingInfo)
    }

    And just in-case if you were wondering how does rule!APN_returnFirstInput work !! Here is the sample code of that rule (nothing much really !! except it returns first input as it is..!!!)

    rule!APN_returnFirstInput(ri!firstInput(AnyType), ri!secondInput(AnyType)){
              ri!firstInput
    }