Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Multi-level sorting

    I've been told this has been implemented in SC8 but cannot find it anywhere in the documentation. Can someone please point me to it? Thanks.

    #2
    If you scan the docs for canMultiSort and setSort, you should find plenty of information there, under LG.setSort in particular - note that, once LG.canMultiSort is true, holding down Shift allows UI-based mutisorting, or you can use the new MultiSortDialog

    Comment


      #3
      Thank you. I was looking at an older build.

      Comment


        #4
        I am having some problems with the canMultiSort. Perhaps I am understanding the feature wrong.

        I have a listgrid in which the data source is server-side. I can initialize the sort columns fine (as in, the data is shown sorting by one column then the other). My problem now is if I try to add another column to sort with by using shift-click, what ends up happening is the other two sorts initialized have been cleared and the data is now only being sorted with that column I clicked on.

        I've tried using the same list grid example with the feature explorer by using the countryList sample data and it works fine. My question is, does sorting still require sorting on the server side? I read somewhere that if the data becomes small enough (which in my case 4 rows should be small enough) that the grid will do client-side sorting.

        Also, if I try removing the data property of the listgrid to just show an empty grid, then I can click on each column header as if I were adding it to the list of sort columns (the sort arrow as well as the sort column # appears on the column header).

        If you could clear this up for me ASAP, that would be great.

        Comment


          #5
          Multi-level sorting does require server-side sort capability if the dataset could ever require paging. Multi-level sort will take place on the client side if the cache is complete, so you can have a DataSource that doesn't implement server-side multi-sort yet still supports the feature if you never use paging.

          The DataSource advertises whether it supports multi-level sort via DataSource.canMultiSort, which defaults to true.

          It's not clear how you could get the behavior you're seeing, so please try to isolate differences relative to the sample.

          Comment


            #6
            Not exactly sure how else to debug this. Maybe you can see something with the code I am using.

            Code:
            isc.VLayout.create({ID:"cwvLayouttable",width:"100%",height:"100%",members:
            [(isc.DataSource.create({ID:"table$ds",fields:
            [{name:"cwPK__",primaryKey:true}],canMultiSort:false,showPrompt:false}),
            
            isc.ListGrid.create({title:" ",$cwShowDetailColumn:true,canMultiSort:true, initialSort:
            [{property:"manager",direction:"ascending"},{property:"userId",direction:"descending"}],
            fastCellUpdates:false,dataSource:"table$ds",ID:"table",hoverStyle:"CwHoverStyle",modalEditing:true,recordBaseStyleProperty:"velocityRowStyle",canSelectText:true,selectOnEdit:true,willHandleErrors:true,autoFetchData:true,canSort:true,selectionProperty:"$isCwSelected",width:"100%",height:"100%",
            fields:[
            {type:"image",showTitle:false,width:15,imageWidth:10,imageHeight:10,getCellValue:function() { return '/cwf/r/cwfv/bullet_triangle_glass_blue.png'; },$cwCellClickMethod:"showDetailAction",name:"_cwShowDetailColumn",align:"left",canEdit:false,validateOnChange:true},
            {title:"<nobr>User ID&nbsp;<\/nobr>",editorType:"text",name:"userId",align:"left",validateOnChange:true,width:"210"},
            {title:"<nobr>Active&nbsp;<\/nobr>",type:"boolean",cwToggleEdit:"false",editorType:"checkbox",name:"active",align:"left",validateOnChange:true,width:"100"},
            {title:"<nobr>Manager&nbsp;<\/nobr>",type:"boolean",cwToggleEdit:"false",editorType:"checkbox",name:"manager",align:"left",validateOnChange:true,width:"100"}
            ]}))]})

            Comment


              #7
              canMultiSort: false on the DataSource overrides canMultiSort: true on the grid

              That is, if a DataSource is incapable of multi-sorting, grids that show it's data are similarly incapable - just get rid of the canMultiSort: false on the DataSource

              Comment


                #8
                This was my original testcase. Unfortunately, I still had the same problem.

                I don't have server-side sorting algorithm so I am relying on the listgrid to do the sorting for me.

                Comment


                  #9
                  OK, we don't have your original testcase and it works fine over here. Let us know if you can shed some more light on the failure you're seeing.

                  Comment

                  Working...
                  X