I am working on a custom DataGridColumn which has a secondary dataProvider to feed a dropdown combobox. The DataGridColumn has the combobox as itemEditor and a label as itemRenderer. The reason for the itemRenderer is that I want to distinguish between Labels and Values. For example, the data in the grid may contain "true" or "false", but the display could be "Enabled" and "Disabled", or something localized. Same for the Combo...

The challenge I am having is the format of the secondary dataProvider. Right now I am using a general Object to pass the second dataProvider. It becomes the dataProvider (via binding) of the dropDown combo which is used as itemEditor. This works well, and upon creationComplete, I select the current grid value in the combobox. The code below is part of the itemEditor...

private function selectThis():void
    {
     var index:int = -1;     
     for(var i:int=0;i<this.dataProvider.length;i++)
     {
      if(this.dataProvider[i][outerDocument.returnField].toString() == this.data [outerDocument.dataField].toString())
      {
       index = i;
       break;
      }
     }
     this.selectedIndex = (index == -1) ? 0 : index;
    }

Now, for the itemRenderer I want to use the same dataProvider (passed to the DataGridColumn and passed thru to the combo control) so that I can 'translate' the data values into a display labels. The itemRenderer is a label control which does not have a dataProvider property on its own. I can still access the dataProvider passed to the DataGridColumn, however, because of the general Object type, the length property is not accessible. Ok, so then I went ahead and converted the incoming Object into an XMLListCollection, and this all works nicely, but it requires I know the incoming object type of the dataProvider, which is what I would like to avoid...

It seems that for list based controls like the combo or grid controls you can pass pretty much any type of dataprovider and it will automatically convert it to some kind of collection (xml or array). I would like to do the same with the incoming object to feed controls that have no built-in dataProvider property.

Is there a generic dataProvider object I could use (one that accepts any type of incoming data), or if not, what would be the best way to do a manual conversion to, say XMLListCollection no matter what the input is?

Hopefully someone has done this before and can provide some ideas... Thanks very much.

 

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to