Is there a way I can pass parameters to the searchStyle function from the code snippet below?
Thank you!
<mx:AdvancedDataGrid id="dgCompetente" includeIn="Competente" x="10" y="66" width="547" height="468"
change="dgCompetente_changeHandler(event)" dataProvider="{colCompetente}"
editable="false" allowMultipleSelection="true" updateComplete="updateDataGridIndex('competente')"
styleFunction="searchStyle">
private function searchStyle(data:Object, col:AdvancedDataGridColumn):Object
{
if (txtSearchCompetente.text != '') {
if (data['denCompetenta'].toLowerCase().indexOf(txtSearchCompetente.text.toLowerCase()) != -1)
return {color:0xFF0000,backgroundColor:0xFFF552,fontWeight:'bold',fontStyle:'italic'};
}
return null;
}
No that is not possible as the function is expected to have this exact signature. If you want to reuse the function for different datagrids, you can create small dedicated functions for each datagrid, which in turn pass their parameters to another function.