Skip to content

Instantly share code, notes, and snippets.

@jmoren
Created June 22, 2012 12:52
Show Gist options
  • Save jmoren/2972579 to your computer and use it in GitHub Desktop.
Save jmoren/2972579 to your computer and use it in GitHub Desktop.
# Esto hizo tonchis hasta ahora.
private var edited_row_index:int;
private function editCell(event:AdvancedDataGridEvent):void{
edited_row_index = event.rowIndex;
ExternalInterface.call('console.log', "Event" + event);
}
private function putNewValue(event:AdvancedDataGridEvent):void{
ExternalInterface.call('console.log', "Event" + event);
var validator:NumberValidator = new NumberValidator();
validator.domain = "int";
var weight:String = TextInput(event.currentTarget.itemEditorInstance).text;
ExternalInterface.call('console.log', 'changing weight');
ExternalInterface.call('console.log', edited_row_index);
ExternalInterface.call('console.log', weight);
if(validator.validate(weight).type == ValidationResultEvent.VALID){
ExternalInterface.call('console.log', 'gonna save');
ExternalInterface.call('console.log', flattenLists);
flattenLists[edited_row_index].weight = weight;
flattenLists[edited_row_index].update();
}else{
Alert.show("Only numeric values are allowed for weight");
}
}
# Este es el agregado del checkbox.
<mx:AdvancedDataGridColumn dataField="active" headerText="Active" editable="true">
<mx:itemRenderer>
<mx:Component>
<mx:Canvas width="100%" height="100%">
<mx:CheckBox selected="{data.active}" verticalCenter="0" horizontalCenter="0"/>
</mx:Canvas>
</mx:Component>
</mx:itemRenderer>
</mx:AdvancedDataGridColumn>
# Este es el inicio de la tabla de listas:
<mx:AdvancedDataGrid showHeaders="true" width="100%" horizontalGridLines="true"
verticalGridLines="true" useRollOver="false" alternatingItemColors="[#ffffff,#f1f1f1]" selectable="false"
borderThickness="0" rowHeight="30" height="100%" id="list_grid" editable="true"
creationComplete="initListGrid();" itemEditEnd="putNewValue(event);" itemEditBegin="editCell(event);" >
<mx:HierarchicalData source="{data.qcallContactLists}" childrenField="tzQcallLists"/>
El problema es que como esta ahi... cualquier update de la tabla, pasa por itemEditEnd => putNewValue(event). Aca tenemos que identificar la fila, la columna, hacer el update y actualizar. Ayer con tonchis estuvimos viendo el tema de events, a ver que goma tienen y que info se les puede sacar. Esto no es definitivo, pero es un intento.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment