0 Replies Latest reply on Jan 6, 2011 8:33 AM by Gregory Lafrance

    Accessing AdvancedDataGrid data in AdvancedDataGridColumn tag.

    Gregory Lafrance Level 6

      In the following code, editable="{data.allowEditDesc=='Y'}" in adg1 definition does not access the row's data. I guess 'data' is only available for item renderers and item editors. I've used editable="{adg2.selectedItem.allowEditDesc=='Y'}" in adg2, and it works, but is that the way to do it? Is there any other way to access the currently rendering row of data, similar to the 'data' property in renderers and editors?

       

      <?xml version="1.0"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
          <mx:Script>
              <![CDATA[
                  import mx.collections.ArrayCollection;
                        
                  [Bindable] private var ac:ArrayCollection = new ArrayCollection([
                    {name: "yes", extra: "one", allowEditDesc: "Y"},
                    {name: "no", extra: "two", allowEditDesc: "N"},
                    {name: "no", extra: "three", allowEditDesc: "N"},
                    {name: "yes", extra: "four", allowEditDesc: "Y"}
                  ]);
              ]]>
          </mx:Script>
          <mx:AdvancedDataGrid id="adg1"
              dataProvider="{ac}" editable="true"
              width="100%" height="100%">
              <mx:columns>
                  <mx:AdvancedDataGridColumn dataField="name"/>
                  <mx:AdvancedDataGridColumn dataField="extra" editable="{data.allowEditDesc=='Y'}"/>
              </mx:columns>
         </mx:AdvancedDataGrid>
          <mx:AdvancedDataGrid id="adg2"
              dataProvider="{ac}" editable="true"
              width="100%" height="100%">
              <mx:columns>
                  <mx:AdvancedDataGridColumn dataField="name"/>
                  <mx:AdvancedDataGridColumn dataField="extra" editable="{adg2.selectedItem.allowEditDesc=='Y'}"/>
              </mx:columns>
         </mx:AdvancedDataGrid>
      </mx:Application>