Sorting not working

Hi ,

In below code default sorting is not working on  UI interface. 

a!gridTextColumn(
label: "Served By",
field: "servedBy",
data:
a!applyComponents(
function: rule!getUserName(_),
array: ri!subset.data.servedBy
)

)

In this we are setting local.paginInfo in load and passing same on ein with() to this dataset subset. Then further this dataset i am passing to another rule where i am keeping grid section. 

After clicking on header column sorting should be work but its not working. Tried lot but not found feasible solution.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    I sincerely hope you're not at a high enough version to support a!forEach and still using applyComponents.  A mighty strong kudos goes out to you for learning to use it, as I have learned it as well and fully understand how nigh impossible that is.  The problem is that the documentation is now so sparse that you're pretty much on your own if you ever have a bug in the applyComponents.  Also, a!forEach is faster, easier, literally faster as in it processes in fewer miliseconds, and more powerful, and more robust.  You can configure it to not crash and explode when it sees a null value.  a!forEach would be a great addition to this code.

    As to your current problem, I think your main difficulty is that your data is not in the form of a datasubset type.  You applyComponents a rule over the data of a datasubset, and it returns a bunch of data, but that data is not in the form of a subset itself.  What the datasubset provides you is a container that keeps both the data and the paging info in one place.  You've got paging info attached to your servedBy, whatever that is, but that's not what you're using for your grid.  Paging info is kind of worthless there.  If you were to attach the same to the output of your apply components, that should work.  Then the grid's paging info is right there with the data you ARE using to populate your grid.  When you change that paging info, you'll re-page the output of the applyComponents.

    Also, you probably want to do all the definition up in the local variables.  I wouldn't put super complex logic right there in the grid definition.  I'd just refer to complex logic I'd already done down there.

    with(

    local!dataForGrid: todatasubset(

    data: a!applyComponents(...your code...),

    pagingInfo: ri!subset.pagingInfo

    )

    ...several lines later

    a!gridTextColumn(

    label: "Served By", 
    field: "servedBy",

    data: local!dataForGrid,

    )

  • +1
    Certified Lead Developer
    in reply to davidl692

    Reading this reply (which i generally agree with) makes me realize that we can't even guess as to why 's sorting isn't working without him posting more code (particularly, how the paginginfo and datasubset are defined in their local variables, and the saveIntos of the gridField).

    Also just as a general reminder, Community has a really neat feature for posting code in its own preformatted box which saves formatting, etc... i'm hoping if Sauravk posts a more verbose copy of the code he can use this feature Slight smile

Reply Children
No Data