2 Replies Latest reply on Feb 8, 2010 5:21 PM by yruan

    datagrid sorting causing issues with custom renderers


      Ok I have a somewhat complicate datagrid renderer set up.

      I have a custom component with 2 datagrids: headerDisplay, container.  both tied to same dataProvider.


      headerDisplay only shows the header, none of the data rows

      container shows 1 column dataProvider.length number of rows, with a custom itemRenderer myItemRenderer that is also passed the dataProvider


      myItemRenderer has 2datagrids.  headerData and detailData.   headerData just shows each field and row of the dataProvider.   detailData ties off one of the fields in the dataProvider that I created, call it detailData_provider.   this detailData is normally collapsed, it can be exploded.   detailData is exploded/collapsed by using visible and showInLayout properties of the datagrid component


      what this creates is basically a display for any typical data model where you have parent datas and child datas to each parent.  kind of like datagrid tree.


      anyway, my problem is this.  when i have row1 exploded, I see row1's headerData, row1's detailData, row2's headerData, row3's headerData, row4's headerData.    while exploded, i click on the headerDisplay's column header, invoking a sort of the dataProvider.   it sorts by ascending order, which happens to keep data in place cause i'm using dummy data that's just 1,2,3,4,5.


      i click headerDisplay column header again to inverse sort...oh boy.

      row4 header, row3 header row3 detail, row2 header, row1 header.


      click again, normal sort

      row1 header, row2 header, row3 header, row3 detail, row4 header


      click again, inverse sort

      row4 header, row3 header, row2 header, row1 header row1 detail.


      click again, normal sort

      row1 header, row2 header, row3 header, row4 header      no detail shows at all



      it seems like the visible&showInLayout is not following the dataProvider record....but it's not staying with the dataGrid's row either.   it moved one row down for each click of the inversion of sorting, to disappear entirely and then restarts the cycle.



      i have not touched the sorting functions of datagrid class at all.   i'm just baffled on how this sorting thing works.