• Sorting REST and Datagrid

    By David Montandon 1 decade ago

    Hello,

     

    I am loading data from a View using XPages REST Service Control.

    Our application is multilingual, the view just return a code. In the restViewColumn I am getting the value from this code using a DbLookup.

     

    The problem is that the Dojo Grid is not sorting even when click on column sort.

     

    I tried to force a sort on viewJsonService but it does not change anything

    sortOrder="ascending" sortColumn="data"

     

    Is there a way to force a sort of the store after change value of columns ?

     

    Thank you

    • Sorting is based on the design...

      By Stephen Auriemma 1 decade ago

      David,

      The ability to sort is based on the design of the view column.

      Is the column "data" sorted in the design of the view specified?

      Regards,

      Steve

      • Sorted columns

        By David Montandon 1 decade ago

        Hi Stephen

         

        Thank you for your answer, I was on holiday and did not get time to replay you befor.

        View columns are sorted (ascending) but as view contains only alias code (not real text).

         

        I uploaded a picture of the design view and xpages result.

         

        Here is the rest service code :

                                    viewName="(xLanguage)" contentType="application/json" var="entry">

                             }}]]>

                        
                            
                                                         
        var key = "LANGUAGE~" + entry.getColumnValue("language") ;
        var lookup = @DbLookup("", "(keyWordsView)", key, 2) ;
        return lookup ;             
                                }]]>

                            

                            
                                                         
        var key = "LANGUAGE-LEVEL~" + entry.getColumnValue("speak") ;
        var lookup = @DbLookup("", "(keyWordsView)", key, 2) ;
        return lookup ;     
                                
                                }]]>

                            

                        


                    

        • Add a new view or column...

          By Stephen Auriemma 1 decade ago

          Hi David,

          You can not sort unless the view being sorted has the data in a column and the column can be sorted. My suggestion would be to create a view that contains the data you would like to sort.