vijayakumar flex
vijayakumar flex

Reputation: 583

how can i disable (enabled="false") particular checkbox in datagrid item Renderer?

In datagrid i shows number of checkbox for example 20 checkboz ,in 20 checkbox if i select any 15 checkboxs then remining checkboxs will be disable (enabled="false" But 15 selected checkbox accessable ? How can i do that . i tried

  <mx:DataGrid id="dg" width="100%" height="100%" rowCount="5" 
        dataProvider="{dp}">
        <mx:columns>
                <mx:DataGridColumn dataField="name" headerText="Name"/>
                <mx:DataGridColumn headerText="Checked" dataField="checked">
                  <mx:itemRenderer>
                    <mx:Component>
                      <mx:CheckBox enabled="{data.checked}" change="{data.checked = this.enabled;}" />
                    </mx:Component>
                  </mx:itemRenderer>
                </mx:DataGridColumn>
        </mx:columns>
    </mx:DataGrid>

Upvotes: 1

Views: 4256

Answers (1)

Joel Hooks
Joel Hooks

Reputation: 6565

You are going to need more robust item renderers (in separate class) that dispatch events up through the grid and into the containing class to perform some business logic on the data provider.

Part 3 of Peter Ent's excellent series on Flex item renderers covers this topic in depth. I highly recommend the entire series if you want in depth knowledge of how to best utilize item renderers in Flex.

Upvotes: 2

Related Questions