2 Replies Latest reply on Mar 13, 2011 2:41 PM by Michael Orzechowski

    Some issues with ItemRenderer(s) on DataGrid

    Michael Orzechowski Level 1

      Dear experts

       

      My struggle to "master" utilizing ItemRenderers on DataGrids continues.
      Kindly take a look at following example (source viewing has been enabled):

       

      http://www.morzech.myzen.co.uk/Flex/ComplexDataGrid/ComplexDataGrid.html

       

      There are couple of things that are tad unclear to me. For instance:

       

      1. Why week number is being refreshed only when I click (anywhere) after I have changed the date and not as soon as date has been changed (content of DataGrid has not been refreshed)?
      I kind of solved that issue by adding call to DataGrid method invalidateDisplayList (see function “chngDateEvent”). However it worked fine only when changing date on not selected row. Furthermore date had to be selected twice for all newly added rows (it disappeared after selecting it first time around)

       

      2. If I add several rows in one setting (using button “Add new line”) some of the new rows have already a value in column “Day type” selected. Where does it come from?!?

       

      Please share your comments/opinions on what I might be doing wrong.

      Also please feel free to make any recommendations as to common/best practices when working on such solution. I know that some things I have done might not exactly qualify as best techniques and I would greatly appreciate your suggestions/guidance in that respect.

       

      Regards
      Michael

        • 1. Re: Some issues with ItemRenderer(s) on DataGrid
          Flex harUI Adobe Employee

          I don't have time to look at your code right now but a few pointers:

           

          1) editing is session-based.  The change is only committed when you switch

          away from the editor not when you change values in the editor.  You may want

          to add code that updates the data item and calls itemUpdated on the

          dataProvider as the data changes

           

          2) Renderers are recycled.  More details on the first item renderer post on

          my blog.

           

          --

          Alex Harui

          Flex SDK Team

          Adobe System, Inc.

          http://blogs.adobe.com/aharui

          1 person found this helpful
          • 2. Re: Some issues with ItemRenderer(s) on DataGrid
            Michael Orzechowski Level 1

            Alex

             

            Thanks for the pointers. I gave up on using ItemRenderers as renderers/editors. I already lost too much time wrestling with this concept. I left only one super straight-forward ItemRenderer (delete button). I have decided to use popup editor for data amending/entry.  I have created custom component with all the fields that are needed for user input. When user double clicks row in DataGrid I am opening popup and populating it with data. Same popup is used to add new row to DataGrid. I find this solution much easier to implement and it’s even better as far as data validation is concerned.

             

            Regards

            Michael