2 Replies Latest reply on Nov 26, 2008 12:06 PM by mpoitras

    Visible Row Count

      I wish to have paged results(something like 10-20 rows out of a few hundreds) in a data grid. When resizing the screen, the datagrid changes size, and thus the number of row displayed changes. I did not find the property or function which allows me to bind unto in order to get the number of visible rows. DataGrid.rowCount is 0 unless set, and it is not bindable. Any idea how I can find that information?
        • 1. Re: Visible Row Count
          rtalton Level 4
          1) The rowCount is the right property. It is zero until the app is finished laying out and sizing all components.
          2) rowCount IS bindable; it just does not dispatch an update event, so if for instance a Label's text property is bound to DataGrid.rowCount, it will always read zero.

          So what you really need to do is get the rowCount AFTER the application's creationComplete event, and whenever the DataGrid changes its size.

          The following code uses the app's creationComplete event to get the initial rowCount property and display it in a Label. I also add an event handler for the DataGrid's render event, which is fired whenever the DataGrid has to re-draw itself.

          There may be an easier way to do it. Maybe someone else has a more elegant solution. Hope this helps.
          • 2. Visible Row Count
            mpoitras Level 1
            The rowCount in the render did not work for me. I was able to retrieve it by subclassing the data grid and using the rowInfo.length. The behavior was finally not appropriate in the paging case since the changing number of rows was throwing off my whole page 1 of 5 and so on. So I am not using it. I still wanted to share it and thank you for your help.