Search code examples
fluttersyncfusion

flutter web:I am trying to add textformfield to table column header for searching in sync fusion syncfusion_flutter_datagrid


flutter web:I am trying to add textformfield to table column header for searching the data columnwise in syncfusion_flutter_datagrid, this was workied in older version of flutter but when i upgrade to flutter 2.0.2 textformfield not accepting the inputs.

screen shot table screenshot

Library ref https://pub.dev/packages/syncfusion_flutter_datagrid

Code snippet

 SfDataGrid(
        columnWidthMode: ColumnWidthMode.fill,
        source: _listDataGridSource,
        headerRowHeight: 100,
        headerCellBuilder: (BuildContext context, GridColumn column) {

            return Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Text(
                  column.headerText,
                  style: TextStyle(fontWeight: FontWeight.normal),
                ),
                SizedBox(height: 10,),
                Container(
                  height: 40,
                  child:TextFormField(
                    key: Key('test'+column.mappingName),
                      onFieldSubmitted: (value){
                      print("Submitted");
                      },
                    
                      autofocus: true,
                      textInputAction: TextInputAction.none,
                      keyboardType:TextInputType.number ,
                      decoration: InputDecoration(
                        hintText: "Search here for"+column.headerText,
                        focusedBorder: OutlineInputBorder(
                          borderSide:
                          BorderSide(color: Colors.grey, width: 1.0),
                        ),
                        enabledBorder: OutlineInputBorder(
                          borderSide:
                          BorderSide(color: Colors.grey, width: 1.0),
                        ),
                      ),
                      onChanged: (value) {
                      setState(() {
                        print('testing');
                        print(value);
                      });

                      }

                  ),


                )
              ],
            );

        },

Solution

  • Greetings from Syncfusion.

    We have analyzed your reported issue. This problem is occurred due to the focus issue of the TextFormField in Flutter 2.0. We have reported this issue to framework. For further details, you can refer to the following link,

    https://github.com/flutter/flutter/issues/78413

    We will get back to you once we got the details from them.