1 Reply Latest reply on Apr 30, 2008 12:18 PM by ntsiii

    AdvancedDataGrid - access to individual cells.

    mcampster
      I am trying to 'access' specific cells within the advanced data grid. I basically have a datagrid, which contains editable data. I would like to be able to click on a button, and have a function validate all of the data within the datagrid. Preferably, I would like to store the result of these validations in a collection, and on return iterate over each result and highlight in some way each cell that contains invalid data.

      The majority of examples only seem to provide validators on itemEditors - and these are called every time a cell is edited. This is not ideal for me, and would like any suggestions as how I can do this in batch?

      Problems I am worried about are:

      If I have to customise itemRenderers to get this effect, what about the rows that are not currently displayed? Is it right that these do not currently exist?

      I would actually like to attach my validator to the underlying source field in the data provider, not the data in the itemRenderer. But as far as I can tell, I then cannot map the results of each validator to the correct item (cell) in the datagrid.

      Any help much appreciated.
        • 1. Re: AdvancedDataGrid - access to individual cells.
          ntsiii Level 3
          Yes, renderers are recycled, so essentially only the visible ones exist. Here is what I would do:
          * Add a property to the dataProvider items to hold the validity state, say bIsValid.
          * Have the renderer, in the set data() or commitProperties() override methods, use this value to visualy show the valid state, maybe turn the background red if invalid, or show an "X", or whatever, and also set the UI state if valid.
          * Have a button on the renderer that dispatches a bubbling event, named something like "validateNowEvent"
          * in the parent document, listen for that event.
          * In that event handler, loop over the dataProvider, validating each item. Set the bIsValid property accordingly

          If you use the dataProvider API, the DG should automatically refresh .

          Tracy