I've been trying to do this and I didn't find a way to make it work with sfDataGrid.
I just receive the cell index when i tap in the cell, but when i want to tap in the button, there is nothing to obtain data from there.
Hi DIEGO Martin FURIATI,
Code snippet:
|
@override DataGridRowAdapter? buildRow(DataGridRow row) { return DataGridRowAdapter( cells: row.getCells().map<Widget>((dataGridCell) { return Container( alignment: Alignment.center, child: dataGridCell.columnName == 'button' ? LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { return ElevatedButton( onPressed: () { showDialog( context: context, builder: (context) => AlertDialog( content: SizedBox( height: 100, child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( 'Employee ID: ${row.getCells()[0].value.toString()}'), Text( 'Employee Name: ${row.getCells()[1].value.toString()}'), Text( 'Employee Designation: ${row.getCells()[2].value.toString()}'), ], )))); }, child: Text(dataGridCell.value)); }) : Text(dataGridCell.value.toString())); }).toList()); } |
Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/sample1472739247
We hope this helps and please let us know if you need any further assistance.
Regards,
Tamilarasan
Thank you!
Hi DIEGO Martin,
We are glad that the provided response meets your requirement. Please let us know if you need further assistance. As always, we are happy to help you out.
Regards,
Tamilarasan